composer / composer/xdebug-handler
PHP binary path hardcoded
- Langage dominant
- PHP
- Étoiles
- 2.6k
- Forks
- 33
- Merge moyen
- 6 h 46 min
- PR mergées (30 j)
- 1
Description
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!
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans src/XdebugHandler.php autour de la ligne 438, où la commande de redémarrage sélectionne PHP_BINARY, et suivez la manière dont cette valeur atteint le redémarrage du processus. Définissez et documentez le comportement de remplacement, y compris le fallback lorsqu'aucun remplacement n'est fourni, puis vérifiez que le binaire configuré est utilisé pour la commande redémarrée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- php
- Domaine
- cli, tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 72/100