Skip to content

[Mime] Form field values with integer keys not resolved correctly  #47504

Closed
@claudiu-cristea

Description

@claudiu-cristea

Symfony version(s) affected

5.4, 6.2

Description

#38323 introduced the possibility to have multiple parts with the same name. However, this PR added some issues: A from element, such as <input type="hidden" name="bar[0][foo]"> is resolved as bar[foo]. But that is wrong, bar[0][foo] is correct. Also it introduced a limitation in the sense if the field name is actually meant to be an integer, eg the following currently is throwing an exception:

new FormDataPart([
    '1' => [
        'a' => 'one',
        'b' => 'two',
    ],
]);

How to reproduce

Create a form containing

```html
<input type="hidden" name="bar[0][foo]" value="v1">

will resolve as bar[foo].

Then create improve the form as...

<input type="hidden" name="bar[0][foo]" value="v1">
<input type="hidden" name="bar[0][baz]" value="v2">

will throw an exception.

Use the HttpBrowser to post the forms.

Possible Solution

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions