bug #38921 [PHPUnitBridge] Fixed crash on Windows with PHP 8 (villfa)

This PR was merged into the 4.4 branch.

Discussion
----------

[PHPUnitBridge] Fixed crash on Windows with PHP 8

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | no
| License       | MIT
| Doc PR        | no

The install command crashed with the message "The filename, directory name, or volume label syntax is incorrect.".
It happens only on Windows with PHP 8.

Probably due to https://github.com/php/php-src/blob/PHP-8.0/UPGRADING#L1121-L1123

I have a small repo to show the problem and how it is fixed: https://github.com/villfa/test-phpunit-bridge

Commits
-------

4b958917fd [PHPUnitBridge] Fixed crash on Windows with PHP 8
This commit is contained in:
Nicolas Grekas 2020-11-02 16:07:32 +01:00
commit ca9ef822cf
1 changed files with 1 additions and 1 deletions

View File

@ -231,7 +231,7 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
}
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
$q = '\\' === \DIRECTORY_SEPARATOR ? '"' : '';
$q = '\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 80000 ? '"' : '';
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));