composer / composer/xdebug-handler
PHP binary path hardcoded
- Lenguaje dominante
- PHP
- Estrellas
- 2.6k
- Forks
- 33
- Merge medio
- 6 h 46 min
- PR fusionados (30 d)
- 1
Descripción
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!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- php
- Área
- cli, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 72/100