-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3.* |
When introducing this mode, I overlooked the fact that file paths could look like this:
phar:///usr/local/bin/phpunit-5/phpunit/Util/Fileloader.php
In that kind of case, there is not always a way to tell if the deprecation was triggered inside or outside a vendor, so IMO I should add a special case just for phar paths in that method:
symfony/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Lines 64 to 86 in ba3b177
$inVendors = function ($path) { | |
/** @var string[] absolute paths to vendor directories */ | |
static $vendors; | |
if (null === $vendors) { | |
foreach (get_declared_classes() as $class) { | |
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { | |
$r = new \ReflectionClass($class); | |
$v = dirname(dirname($r->getFileName())); | |
if (file_exists($v.'/composer/installed.json')) { | |
$vendors[] = $v; | |
} | |
} | |
} | |
} | |
$path = realpath($path) ?: $path; | |
foreach ($vendors as $vendor) { | |
if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) { | |
return true; | |
} | |
} | |
return false; | |
}; |
Not sure how realpath
behave with such paths, BTW
I wonder how / if I'm going to be able to test that though... any ideas?
soullivaneuh