[HttpKernel] Fatal Error when using #[MapUploadedFile] with non-array/non-variadic argument#57824
Closed
melya wants to merge 3 commits into
Closed
[HttpKernel] Fatal Error when using #[MapUploadedFile] with non-array/non-variadic argument#57824melya wants to merge 3 commits into
#[MapUploadedFile] with non-array/non-variadic argument#57824melya wants to merge 3 commits into
Conversation
Contributor
Author
|
@renedelima Thanks for this feature 💪 . |
MapUploadedFile for non-array/non-variadic arguments
MapUploadedFile for non-array/non-variadic arguments#[MapUploadedFile] for non-array/non-variadic arguments
#[MapUploadedFile] for non-array/non-variadic arguments#[MapUploadedFile] as non-array/non-variadic argument
#[MapUploadedFile] as non-array/non-variadic argument#[MapUploadedFile] with non-array/non-variadic argument
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
LGTM, I just have minor comments.
Contributor
Author
|
Seems like failed tests are unrelated to my changes |
Contributor
Author
|
@nicolas-grekas @stetodd friendly reminder ;) |
faa10b6 to
93d4190
Compare
Contributor
Author
|
any updates? |
fabpot
approved these changes
Aug 23, 2025
Member
|
It looks like we've already worked on the same problem in #61381. Can you have a look and rebase this PR accordingly (maybe this PR is not needed anymore)? |
Member
nicolas-grekas
added a commit
that referenced
this pull request
Feb 2, 2026
…colas-grekas) This PR was merged into the 7.4 branch. Discussion ---------- [HttpKernel] Fix handling empty MapUploadedFile arrays | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT An edge case spotted while reviewing #57824 and that we missed in #61381. Commits ------- 25378d2 [HttpKernel] Fix handling empty MapUploadedFile arrays
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
Sign up for free
to 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.
Having a simple controller with
MapUploadedFileas non-array.When the
fileis omitted in request, symfony throwsValueErrorbecause resolver returns an empty array and it doesn't match withUploadedFile $file.In my opinion, the HttpException should be thrown in this case.
For array argument the behaviour stays the same.
Example with omitted
file-ValueErroroccurs hereError example