Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

File upload fails due to PHP 8's additon of extra key during the request. (Similar issue:- https://github.com/symfony/symfony/issues/46146) #50624

Copy link
Copy link
Closed as not planned
@touhid1259

Description

@touhid1259
Issue body actions

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".

SymfonyBug

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.