composer / composer/xdebug-handler

PHP binary path hardcoded

Offen Anfängerfreundlich
#172 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
2.6k
Forks
33
Ø Merge
6 Std. 46 Min.
Gemergte PRs (30 T.)
1

Beschreibung

Would it be possible to be able to override path to PHP binary inside this handler, please? Maybe using some ENV variable?
I am using wrapper for PHP 8.5 under WSL1, so PHP_BINARY constant does not return wrapper, but original binary. Therefore I get this error when running composer under PHP 8.5 with Xdebug enabled:

```
PHP Warning: proc_open(): posix_spawn() failed: Exec format error in phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/XdebugHandler.php on line 300
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/composer:0
PHP 2. require() /usr/local/bin/composer:29
PHP 3. Composer\XdebugHandler\XdebugHandler->check() phar:///usr/local/bin/composer/bin/composer:43
PHP 4. Composer\XdebugHandler\XdebugHandler->restart($command = [0 => '/usr/bin/php8.5-bin', 1 => '-n', 2 => '-c', 3 => '/tmp/fh3d7t9hgapgdGR3Iik', 4 => '/usr/local/bin/composer']) phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/XdebugHandler.php:149
PHP 5. Composer\XdebugHandler\XdebugHandler->doRestart($command = [0 => '/usr/bin/php8.5-bin', 1 => '-n', 2 => '-c', 3 => '/tmp/fh3d7t9hgapgdGR3Iik', 4 => '/usr/local/bin/composer']) phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/XdebugHandler.php:274
PHP 6. proc_open($command = [0 => '/usr/bin/php8.5-bin', 1 => '-n', 2 => '-c', 3 => '/tmp/fh3d7t9hgapgdGR3Iik', 4 => '/usr/local/bin/composer'], $descriptor_spec = [], $pipes = NULL) phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/XdebugHandler.php:300
```

It would be nice if path to PHP binary could be specified manually here.

Here is relevant part:
https://github.com/composer/xdebug-handler/blob/main/src/XdebugHandler.php#L438

Instead of:
```
$php = [PHP_BINARY];
```

Maybe something like:

```
$php = [getenv('PHP_BINARY') ?: PHP_BINARY];
```

Or some other solution...?

Thanks!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start in src/XdebugHandler.php around line 438, where the restart command selects PHP_BINARY, and trace how that value reaches the process restart. Define and document the override behavior, including the fallback when no override is provided, then verify that the configured binary is used for the restarted command.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
cli, tooling
Issue-Typ
Feature
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
72/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.