-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Inject also query parameters as controller arguments #3254
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
Comments
Hi, in my opinion You have to check in action where the $name will be used. Maybe the index action wouldn't work fine without $name or with $name = null, that's right? You may define default value for name like this:
and it will be working without going to action and removing $name argument . |
no, |
@fabpot what do you think about it ? |
I've already rejected the same proposal in the past. Right now, the possible values are defined by the route and you cannot add any other one. But if you allow values from the query string, then the end user is able to inject any value in your controllers. This is a major security hole. |
wouldn't the proper way be to implement uri templates for query parameters (see #3227)? |
@fabpot sorry for trying to revive an old topic, but what if the only parameters from the query string which would get transformed into controller arguments were the ones set in the routing definition? I see little security problem with it. |
@gggeek your use case seems to be a bad architecture. If you need to reuse your logic outside the controller (for a CLI for instance), you should extract the logic to a separate class rather than trying to call your controller from the CLI (the CLI does not expect an HTTP Response anyway) |
@stof I do not disagree in theory, but that adds a lot of boilerplate code if you do it for many controllers |
Hello, |
There is some inconsistency now. For example I have route
and action
And after some time we want change route
After this change urls will containe name as get parameter, this part is ok. But controller hasn't more argument
$hello
, so after changing in route I should go to each controllers and change also some code.https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php#L110
The text was updated successfully, but these errors were encountered: