-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpKernel] Fatal Error when using #[MapUploadedFile] with non-array/non-variadic argument
#57824
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.1
Are you sure you want to change the base?
[HttpKernel] Fatal Error when using #[MapUploadedFile] with non-array/non-variadic argument
#57824
Conversation
|
@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
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just have minor comments.
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Outdated
Show resolved
Hide resolved
...ony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UploadedFileValueResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestPayloadValueResolver.php
Show resolved
Hide resolved
|
Seems like failed tests are unrelated to my changes |
|
@nicolas-grekas @stetodd friendly reminder ;) |
faa10b6 to
93d4190
Compare
|
any updates? |
|
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)? |
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