-
-
Notifications
You must be signed in to change notification settings - Fork 57
Fixes #9 Bridge error when no file is selected #10
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
ahundiak
commented
Aug 19, 2015
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #9 |
License | MIT |
Doc PR | n/a |
Please see tests failure (double space + parse error on 5.3) |
@stof suggested to fix Symfony directly. What is the selected solution? |
I don't see how the S2.7 Request object could be modified without introducing a significant bc break. This is an easy fix which won't impact anything even if the request 3.x object is fixed. And I do want to use the bridge for my 2.3/2.7 projects. |
@ahundiak avoiding to put |
@stof - From the cookbook: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html#basic-setup
I'm guessing that quite a few people are just checking for null and not bothering to check the error status. One could of course argue that the file status should always be checked but I know I don't. Understand that I'm not arguing against "fixing" the request object. It's definitely the right thing to do in 3.x. But as far as the bridge goes for existing code, I don't see the harm in handling nulls. |
@ahundiak this is about a file in the Doctrine entity. It has nothing to do with the HttpFoundation error checking (which is checked by the validator component during the form binding in the example you linked. and if you work with HttpFoundation directly, you have to check the errors otherwise your code is totally broken. |
@stof - I'll be glad to submit a pr against the file parameter bag object. The current behavior is documented in a test:
Easy enough to make the change. |
What do you think @symfony/deciders? Should we merge this PR or change the (tested) Behavior in HttpFoundation? |
@fabpot what do you think about this one? |
Imho changing the behaviour in the ping @symfony/deciders |
👍 for this patch |
@@ -86,6 +86,10 @@ private function getFiles(array $uploadedFiles) | |||
$files = array(); | |||
|
|||
foreach ($uploadedFiles as $key => $value) { | |||
if ($value === 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.
YODA: null === $value
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've always been curious why the Symfony source prefers null
to come first. What's the reasoning?
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.
👍 for finishing this patch. |
Ping @ahundiak - will you be able to make the suggested changes? |
When I get time. If someone else want to do then that would be fine with On Sun, Apr 24, 2016 at 1:11 PM, Ryan Weaver [email protected]
|
I've fixed the stuff mentioned in code-review, in this PR: Danielss89#1 to @ahundiak original branch. If he doesn't merge within a couple of days, i will create a new PR for this repo instead. |
@Danielss89 it looks like your PR got closed? You can totally also make a new PR - if you include the original commits, that would be awesome and we can get this guy taken care of. |
Opened a new PR also. See #23 |
closing in favour of #23 |
Fixes #9 Bridge error when no file is selected symfony#10