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][FileLocator] Fix deprecation message #35269

Merged

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Jan 8, 2020

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.

@@ -75,13 +75,13 @@ public function locate($file, $currentPath = null, $first = true)
}

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternative: $triggerDeprecation = $deprecatedPath; and then use $triggerDeprecation later but that seemed less readable.

@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Jan 8, 2020
@@ -75,13 +75,13 @@ public function locate($file, $currentPath = null, $first = true)
}
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it be a continue statement instead of return $locations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #34886 (comment) for the explanation I guess.

@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

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
@nicolas-grekas nicolas-grekas merged commit 18ce839 into symfony:4.4 Jan 9, 2020
@fancyweb fancyweb deleted the http-kernel-fix-file-locator-deprec branch January 9, 2020 09:51
This was referenced Jan 21, 2020
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

4 participants