-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected
7.1
Description
In the changeUserPicture() function, if the 'name' parameter in the MapUploadedFile attribute is missing or invalid, it results in a type error being thrown. This behavior could lead to unexpected exceptions and is not clearly handled.
How to reproduce
public function changeUserPicture(
#[MapUploadedFile(
constraints: new Assert\File(mimeTypes: ['image/png', 'image/jpeg']),
)] ?UploadedFile $picture
): Response
{
//
}Possible Solution
public function changeUserPicture(
#[MapUploadedFile(
constraints:
new Assert\File(mimeTypes: ['image/png', 'image/jpeg']),
name:
'file'
)] ?UploadedFile $picture
): Response
{
//
}