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

Why InputBag in parameters shouldn't support array as value? #44788

Closed
atlance opened this issue Dec 24, 2021 · 1 comment
Closed

Why InputBag in parameters shouldn't support array as value? #44788

atlance opened this issue Dec 24, 2021 · 1 comment

Comments

@atlance
Copy link

atlance commented Dec 24, 2021

Description

Definition:

InputBag is a container for user input values such as $_GET, $_POST, $_REQUEST, and $_COOKIE.

For api (via json), value-array in parameter is simple case ... why override parent get in InputBag?
Array of ids in $_POST\ $_GET is this a problem?
Or what to do in this case?

Example

No response

@wouterj
Copy link
Member

wouterj commented Dec 24, 2021

See #34363 for an explanation. Allowing scalar and non-scalar return values leads to 500's (unless you explicitly check the return type every time you fetch a value from the bag). The input values (get, post, request, cookie) only support scalar values in the HTTP spec if I recall correctly.

Other related issues about this topic: #41766 #40315 #37265 #37100

I've opened #44789 as I believe we missed something in this long list of issues/PRs. Other than that, I feel like there is little to do here. If you have any more questions on how to use Request with JSON bodies, please use one of the support channels (e.g. Slack or GitHub Discussions): https://symfony.com/support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants