Description
Symfony version(s) affected
may be all versions
Description
I was upgrading one project from php 7 to php 8. After the upgrade the file upload failed due to the addition of extra key "full_path" during file upload request by php 8. When I debugged, I found that, in the "FileBag.php" file in symfony/http-foundation has miss match with this extra key "full_path".
So, due to that, instead of getting "UploadedFile" object, I am getting an array which breaks the code.
How to reproduce
In any php 8 project, if the symfony/http-foundation is used, then during the file upload if someone tries to access the "UploadedFile" object's method, it throws an error. For example, in the controller,
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); $uploadedFileObject = $request->files->get('file_to_upload');
suppose to give you the \HttpFoundation\File\UploadedFile(https://github.com/symfony/http-foundation/blob/6.0/File/UploadedFile.php) Object.
Now calling any accessible method of UploadedFile Class on this $uploadedFileObject variable should through the error.
$ext = $uploadedFileObject->getClientOriginalExtension();
Possible Solution
No response
Additional Context
No response