Skip to content

Commit cb7b398

Browse files
committed
[PHPUnitBridge] Fix Uncaught ValueError
1 parent 87aa6bd commit cb7b398

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bin/simple-phpunit.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@
238238
$passthruOrFail("$COMPOSER config --unset platform.php");
239239
}
240240
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
241-
$p = str_repeat('../', substr_count("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR", '/', strlen($root))).'vendor/symfony/phpunit-bridge';
241+
$haystack = "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR";
242+
$rootLen = strlen($root);
243+
244+
$p = ($rootLen <= strlen($haystack) ? str_repeat('../', substr_count($haystack, '/', $rootLen)) : '').'vendor/symfony/phpunit-bridge';
242245
if (realpath($p) === realpath($path)) {
243246
$path = $p;
244247
}

0 commit comments

Comments
 (0)