Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4c0b84

Browse files
bug #35219 [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script (oleg-andreyev)
This PR was squashed before being merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #34796 | License | MIT | Doc PR | - Locally using [phpenv](https://github.com/phpenv/phpenv) together [phpenv-composer](https://github.com/ngyuki/phpenv-composer) with for managing php versions and composer installations. `which composer` is detecting wrapper instead of binary. Before appending PHP executable to composer path need to validate that detected composer is not a wrapper otherwise PHP will simply return the content of a wrapper Commits ------- 25c805e [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script
2 parents 7fa87b4 + 25c805e commit c4c0b84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ foreach ($defaultEnvs as $envName => $envValue) {
6060
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
6161
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
6262
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
63-
? $PHP.' '.escapeshellarg($COMPOSER)
63+
? (file_get_contents($COMPOSER, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
6464
: 'composer';
6565

6666
if (false === $SYMFONY_PHPUNIT_REMOVE = getenv('SYMFONY_PHPUNIT_REMOVE')) {

0 commit comments

Comments
 (0)