Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Don't rely onSymfony\Component\HttpFoundation\File\File if http-foundation isn't installed in FileType#25152
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…http-foundation isn't
sroze 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.
Yep, seems legit 👍
| { | ||
| $dataClass =function (Options$options) { | ||
| return$options['multiple'] ?null :'Symfony\Component\HttpFoundation\File\File'; | ||
| return$options['multiple']|| !class_exists('Symfony\Component\HttpFoundation\File\File')?null :'Symfony\Component\HttpFoundation\File\File'; |
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.
shouldn't the check be done a few lines below, when callingsetDefaults?
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.
I agree with you, and fixed it.
fabpot commentedNov 26, 2017
Thank you@issei-m. |
…e\File` if http-foundation isn't in FileType (issei-m)This PR was squashed before being merged into the 2.7 branch (closes#25152).Discussion----------[Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | may need discussion| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aCurrently `FileType` may depend on `Symfony\Component\HttpFoundation\File\File` regardless `http-foundation` has been installed or not.It leads to occur the class-not-found error.(Attached the screen capture, please see below and I provided the representation [here](issei-m/form-bug-representation#1) for your information)So I ensure `Symfony\Component\HttpFoundation\File\File` does exist, and if not, we don't specify any classes for this type.While setting no specified class to `data_class` means making [property path behavior changed](https://github.com/symfony/symfony/blob/7234bfd56a9aa388db839af066f24c7ec70f86e9/src/Symfony/Component/Form/Form.php#L229-L231),[NativeRequestHandler](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/NativeRequestHandler.php) which is usually expected to be used in non-full-stack env handles a pure array like `$_FILES` holds, fully intended behavior AFAIK.Commits-------a264238 [Form] Don't rely on if http-foundation isn't in FileType
Symfony\Component\HttpFoundation\File\File if http-foundation isn't in FileTypeSymfony\Component\HttpFoundation\File\File if http-foundation isn't installed in FileType
Uh oh!
There was an error while loading.Please reload this page.
Currently
FileTypemay depend onSymfony\Component\HttpFoundation\File\Fileregardlesshttp-foundationhas been installed or not.It leads to occur the class-not-found error.
(Attached the screen capture, please see below and I provided the representationhere for your information)
So I ensure
Symfony\Component\HttpFoundation\File\Filedoes exist, and if not, we don't specify any classes for this type.While setting no specified class to
data_classmeans makingproperty path behavior changed,NativeRequestHandler which is usually expected to be used in non-full-stack env handles a pure array like
$_FILESholds, fully intended behavior AFAIK.