-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] trim the leading backslash in the controller init #32541
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] trim the leading backslash in the controller init #32541
Conversation
src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
Outdated
Show resolved
Hide resolved
dce0fc6
to
a8ec428
Compare
updated Status: Needs Review |
I would trim only when really needed. What makes trimming neeeded in the first place? |
You've changed a method that deals with errors, so this looks suspicious to me. |
a8ec428
to
029f653
Compare
Okay I've misread the whole think, was only thinking about the comment, but hey, this is the right fix and I understand why is was deprecated. So maybe the even better fix is to deprecate using backslash like in the first PR that has been closed ;). WDYT @fabpot ? |
I think I still don't get the problem. Can you explain it to me again? Perhaps with an example? |
IIUC, this PR fixes issues when defining routes like this: my_route:
path: /whatever
controller: \App\Controller\DefaultController Not sure it's really common, but IMO this should be supported anyway |
029f653
to
8be6297
Compare
8be6297
to
3c8d395
Compare
Thank you @Simperfit. |
…init (Simperfit, fabpot) This PR was submitted for the 4.4 branch but it was merged into the 4.3 branch instead (closes #32541). Discussion ---------- [HttpKernel] trim the leading backslash in the controller init | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #29945 | License | MIT | Doc PR | none <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> This fixes an error where the classes exists when using a leading backslash in the controller, it's not invalid to do so. see #30045 (comment) Commits ------- 3c8d395 [HttpKernel] fixed class having a leading \ in a route controller 6fdf252 [HttpKernel] trim the leading backslash in the controller init
This fixes an error where the classes exists when using a leading backslash in the controller, it's not invalid to do so.
see #30045 (comment)