Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Mime] Fixing multidimensional array structure with FormDataPart#34032
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
…array, which makes it recognizable as an array by PHP on the $_POST globals once it is coming from the HttpClient component
2164f3a toca630e5Comparenicolas-grekas approved these changesNov 28, 2019
fabpot approved these changesNov 30, 2019
Member
fabpot commentedNov 30, 2019
Thank you@jvahldick. |
fabpot added a commit that referenced this pull requestNov 30, 2019
…taPart (jvahldick)This PR was merged into the 4.4 branch.Discussion----------[Mime] Fixing multidimensional array structure with FormDataPart| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#33063#34031| License | MIT| Doc PR | -The issue is pretty much described on#34031The current structure of the raw body build on FormDataPart is not well recognized by the server. It considers all the fields as a root type, when actually it is possible to send arrays by html forms.Lets the following structure on the html```html<input type="text" name="names[]" value="John" /><input type="text" name="names[]" value="Doe" />```It creates the following raw body:```----------------------------466490401959219490193856Content-Disposition: form-data; name="names[]"John----------------------------466490401959219490193856Content-Disposition: form-data; name="names[]"Doe----------------------------466490401959219490193856--```Meanwhile, the FormDataPart on Mime component generates the following body:```--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_Content-Type: text/plain; charset=utf-8Content-Transfer-Encoding: 8bitContent-Disposition: form-dataJohn--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_Content-Type: text/plain; charset=utf-8; name=1Content-Transfer-Encoding: 8bitContent-Disposition: form-data; name=1Doe--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_--```For more complex structures, the $_POST doesn't even recognize properly the field names and values.Commits-------ca630e5 Changing the multipart form-data behavior to use the form name as an array, which makes it recognizable as an array by PHP on the $_POST globals once it is coming from the HttpClient component
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
The issue is pretty much described on#34031
The current structure of the raw body build on FormDataPart is not well recognized by the server. It considers all the fields as a root type, when actually it is possible to send arrays by html forms.
Lets the following structure on the html
It creates the following raw body:
Meanwhile, the FormDataPart on Mime component generates the following body:
For more complex structures, the $_POST doesn't even recognize properly the field names and values.