-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Fixed ContextErrorException in FileType #25102
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
Conversation
|
||
foreach ($event->getData() as $file) { | ||
if (!is_array($files)) { |
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.
What about checking for null
here first and then dropping everything afterwards that is not an array?
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.
or maybe just:
if (!is_array($files)) {
$files = array(null);
}
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.
@xabbuh Thank you, I fixed it.
|
||
foreach ($event->getData() as $file) { | ||
if (!is_array($files)) { | ||
$files = array(null); |
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.
$files = array();
also looks more better to me, it reduces the redundant traverse over them and RequestHandlerInterface::isFileUpload()
method call.
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.
fixed while merging
Thank you @chihiro-adachi. |
…achi) This PR was squashed before being merged into the 2.7 branch (closes #25102). Discussion ---------- [Form] Fixed ContextErrorException in FileType | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25063 | License | MIT | Doc PR | -- Fixed an issue that ContextErrorException occurs when multiple is enabled. Commits ------- 1b408e6 [Form] Fixed ContextErrorException in FileType
Fixed an issue that ContextErrorException occurs when multiple is enabled.