Skip to content

Commit b641fdd

Browse files
committed
feature #43017 [HttpFoundation] Map multipart/form-data as form Content-Type (keichinger)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpFoundation] Map `multipart/form-data` as `form` Content-Type | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? |yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? |no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | #34240 | License | MIT | Doc PR | – As per RFC 2045 and RFC 2388 (see https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2), the `multipart/form-data` Content-Type should be used when submitting a mixed forms containing files, binary data and non-ASCII data. Currently, the same logic that would run in regular, non-mixed form scenarios can't run for mixed forms, as soon as it relies on the result of `Request::getContentType()` or anything else that might rely on `Request::$formats` without going low-level and avoiding the implemented abstraction. This PR fixes that. Resolves #34240 Commits ------- e597655 Map `multipart/form-data` as `form` Content-Type
2 parents 6c2608b + e597655 commit b641fdd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ protected static function initializeFormats()
19881988
'rdf' => ['application/rdf+xml'],
19891989
'atom' => ['application/atom+xml'],
19901990
'rss' => ['application/rss+xml'],
1991-
'form' => ['application/x-www-form-urlencoded'],
1991+
'form' => ['application/x-www-form-urlencoded', 'multipart/form-data'],
19921992
];
19931993
}
19941994

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ public function getFormatToMimeTypeMapProvider()
501501
['xml', ['text/xml', 'application/xml', 'application/x-xml']],
502502
['rdf', ['application/rdf+xml']],
503503
['atom', ['application/atom+xml']],
504+
['form', ['application/x-www-form-urlencoded', 'multipart/form-data']],
504505
];
505506
}
506507

0 commit comments

Comments
 (0)