Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpKernel] fix triggering deprecation in file locator #34886

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Dec 9, 2019

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #34556
License MIT
Doc PR

@acasademont
Copy link
Contributor

@xabbuh I can confirm the fix works and the deprecation is not triggered anymore! Nice :D

src/Symfony/Component/HttpKernel/Config/FileLocator.php Outdated Show resolved Hide resolved
// no need to trigger deprecations when the loaded file is given as absolute path
foreach ($this->paths as $deprecatedPath) {
if (\is_array($locations)) {
foreach ($locations as $location) {
if (null !== $currentPath && 0 === strpos($location, $currentPath)) {
return $locations;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, when there are several paths and one of them is not deprecated, we don't know anymore if a deprecated path is going to be used or not, so we skip the deprecation to prevent a false-positive. This means we might miss a deprecation, but that's the best we can do, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am afraid there isn't anything we can do about this. Either we trigger deprecations where we shouldn't or we miss some where they would be appropriate.

@fabpot
Copy link
Member

fabpot commented Dec 11, 2019

Thank you @xabbuh.

fabpot added a commit that referenced this pull request Dec 11, 2019
…abbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] fix triggering deprecation in file locator

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34556
| License       | MIT
| Doc PR        |

Commits
-------

142b179 fix triggering deprecation in file locator
@fabpot fabpot merged commit 142b179 into symfony:4.4 Dec 11, 2019
@xabbuh xabbuh deleted the issue-34556 branch December 11, 2019 07:03
This was referenced Dec 19, 2019
nicolas-grekas added a commit that referenced this pull request Jan 9, 2020
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 #34886

`$deprecatedPath` is the foreach value so it only works if the last element triggers the deprecation, otherwise the value is wrong.

Commits
-------

18ce839 [HttpKernel][FileLocator] Fix deprecation message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants