-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Files upload is broken for PHP 8.1 because of new key full_path is added #46146
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
Labels
Comments
Do you want to submit a PR fixing the check ? |
@stof I'll try to make a PR. Will it be good solution to just duplicate unset from HttpFoundation component fix to keep functions logic the same? |
This was referenced Apr 22, 2022
fabpot
added a commit
that referenced
this issue
Apr 23, 2022
…PHP 8.1 (p-golovin) This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead. Discussion ---------- Modify processing of uploaded files to be compatible with PHP 8.1 Remove full_path from keys before check Keep logic the same as in src/Symfony/Component/HttpFoundation/FileBag.php | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #46146 | License | MIT Commits ------- a5cc1e1 Modify processing of uploaded files to be compatible with PHP 8.1
Largo
added a commit
to Largo/symfony-http-foundation
that referenced
this issue
May 17, 2022
holdmann
pushed a commit
to holdmann/symfony-http-foundation
that referenced
this issue
Jun 21, 2024
…y PHP 8.1 symfony/symfony#46146 (cherry picked from commit 45e8d45)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
5.4.7, 6.0.7, 6.1
Description
There is hardcoded array of keys for $_FILES in https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Form/NativeRequestHandler.php.
It is checked against posted data in two cases:
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Form/NativeRequestHandler.php#L204
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Form/NativeRequestHandler.php#L240
In PHP 8.1 was added new key full_path (https://php.watch/versions/8.1/$_FILES-full-path). As a result check is broken and we get incorrect format of image's array at https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Form/NativeRequestHandler.php#L93 and error that form contains not allowed extra fields.
How to reproduce
We use Form component as standalone without entire framework but within our cms. Problem looks obvious, but if it will be needed, I'll try to create code for reproduce problem.
Possible Solution
I've found that such problem was already fixed in HttpFoundation component: #42112
Additional Context
No response
The text was updated successfully, but these errors were encountered: