bug #35269 [HttpKernel][FileLocator] Fix deprecation message (fancyweb)
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel][FileLocator] Fix deprecation message
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Ref https://github.com/symfony/symfony/pull/34886
`$deprecatedPath` is the foreach value so it only works if the last element triggers the deprecation, otherwise the value is wrong.
Commits
-------
18ce8399d2
[HttpKernel][FileLocator] Fix deprecation message
This commit is contained in:
commit
62c4608e17
@ -65,7 +65,7 @@ class FileLocator extends BaseFileLocator
|
|||||||
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
|
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
|
||||||
|| null !== parse_url($file, PHP_URL_SCHEME)
|
|| null !== parse_url($file, PHP_URL_SCHEME)
|
||||||
)) {
|
)) {
|
||||||
$triggerDeprecation = false;
|
$deprecation = false;
|
||||||
|
|
||||||
// no need to trigger deprecations when the loaded file is given as absolute path
|
// no need to trigger deprecations when the loaded file is given as absolute path
|
||||||
foreach ($this->paths as $deprecatedPath) {
|
foreach ($this->paths as $deprecatedPath) {
|
||||||
@ -75,13 +75,13 @@ class FileLocator extends BaseFileLocator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($location, $deprecatedPath) && (null === $currentPath || false === strpos($location, $currentPath))) {
|
if (0 === strpos($location, $deprecatedPath) && (null === $currentPath || false === strpos($location, $currentPath))) {
|
||||||
$triggerDeprecation = true;
|
$deprecation = 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($triggerDeprecation) {
|
if ($deprecation) {
|
||||||
@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);
|
@trigger_error($deprecation, E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user