diff --git a/PHPUnit/Util/GlobalState.php b/PHPUnit/Util/GlobalState.php index 7065a0d7480..f55ab9b4366 100644 --- a/PHPUnit/Util/GlobalState.php +++ b/PHPUnit/Util/GlobalState.php @@ -197,6 +197,13 @@ public static function getIncludedFilesAsString() if (defined('__PHPUNIT_PHAR__')) { $prefix = 'phar://' . __PHPUNIT_PHAR__ . '/'; } + + // Do not process bootstrap script - composer v2 compatibility + // https://github.com/composer/composer/issues/10387#issuecomment-1002942296 + // https://github.com/sebastianbergmann/phpunit/pull/4846 + while (strpos($files[0], 'bin/phpunit') !== false) { + array_shift($files); + } for ($i = count($files) - 1; $i > 0; $i--) { $file = $files[$i];