8000 fix triggering deprecation in file locator · symfony/symfony@3e286d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e286d2

Browse files
committed
fix triggering deprecation in file locator
1 parent 3314677 commit 3e286d2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Symfony/Component/HttpKernel/Config/FileLocator.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,30 @@ public function locate($file, $currentPath = null, $first = true)
6565
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
6666
|| null !== parse_url($file, PHP_URL_SCHEME)
6767
)) {
68+
$triggerDeprecation = false;
69+
6870
// no need to trigger deprecations when the loaded file is given as absolute path
6971
foreach ($this->paths as $deprecatedPath) {
7072
if (\is_array($locations)) {
7173
foreach ($locations as $location) {
74+
if (null !== $currentPath && 0 === strpos($location, $currentPath)) {
75+
return $locations;
76+
}
77+
7278
if (0 === strpos($location, $deprecatedPath) && (null === $currentPath || false === strpos($location, $currentPath))) {
73-
@trigger_error(sprintf('Loading the file "%s" from the global resource directory "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $file, $deprecatedPath), E_USER_DEPRECATED);
79+
$triggerDeprecation = true;
7480
}
7581
}
7682
} else {
7783
if (0 === strpos($locations, $deprecatedPath) && (null === $currentPath || false === strpos($locations, $currentPath))) {
78-
@trigger_error(sprintf('Loading the file "%s" from the global resource directory "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $file, $deprecatedPath), E_USER_DEPRECATED);
84+
$triggerDeprecation = true;
7985
}
8086
}
8187
}
88+
89+
if ($triggerDeprecation) {
90+
@trigger_error(sprintf('Loading the file "%s" from the global resource directory "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $file, $deprecatedPath), E_USER_DEPRECATED);
91+
}
8292
}
8393

8494
return $locations;

0 commit comments

Comments
 (0)
0