8000 Confusing exception when using action injection + casing mismatch in routing file · Issue #28254 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /div>

Confusing exception when using action injection + casing mismatch in routing file #28254

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

Closed
ostrolucky opened this issue Aug 23, 2018 · 1 comment
Labels
Bug DependencyInjection Help wanted Issues and PRs which are looking for volunteers to complete them. Status: Needs Review

Comments

@ostrolucky
Copy link
Contributor

Having such action:

public function index(Request $request, PostRepository $posts): Response

and such routing:

index:
    path: /en/blog
    controller: App\Controller\BlogController::Index

yields

Controller "App\Controller\BlogController::Index()" requires that you provide a value for the "$posts" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

This is because user made a typo in routing and used BlogController::Index, instead of BlogController::index

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Aug 30, 2018

I think we can fix this by making the method access case insensitive in ServiceValueResolver (mapping lowercased method names also in RegisterControllerArgumentLocatorsPass [edit: methods are already lowercased there].)
Would you like to give it a try?

8000

@nicolas-grekas nicolas-grekas added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Sep 7, 2018
nicolas-grekas added a commit that referenced this issue Sep 9, 2018
…se insensitive (nicoweb)

This PR was merged into the 3.4 branch.

Discussion
----------

[Controller][ServiceValueResolver] Making method access case insensitive

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28254
| License       | MIT
| Doc PR        | -

Fix #28254 by making the method access insensitive in `ServiceValueResolver`.

Commits
-------

cc6f827 [Controller][ServiceValueResolver] Making method access case insensitive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug DependencyInjection Help wanted Issues and PRs which are looking for volunteers to complete them. Status: Needs Review
Projects
None yet
Development

No branches or pull requests

4 participants
0