You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #47505 [Mime] Form field values with integer keys not resolved correctly (claudiu-cristea)
This PR was squashed before being merged into the 5.4 branch.
Discussion
----------
[Mime] Form field values with integer keys not resolved correctly
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#47504
| License | MIT
| Doc PR |
This should be legit:
```
new FormDataPart([
'qux' => [
[
'foo' => 'v1',
'baz' => 'v2',
],
[
'foo' => 'v3',
'baz' => 'v4',
],
],
]);
```
Fixes#47504
Commits
-------
923de03 [Mime] Form field values with integer keys not resolved correctly
Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ private function prepareFields(array $fields): array
58
58
$values = [];
59
59
60
60
$prepare = function ($item, $key, $root = null) use (&$values, &$prepare) {
61
-
if (\is_int($key) && \is_array($item)) {
61
+
if (null === $root && \is_int($key) && \is_array($item)) {
62
62
if (1 !== \count($item)) {
63
63
thrownewInvalidArgumentException(sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item)));
$this->expectExceptionMessage('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, 2 provided.');
0 commit comments