8000 File upload is broken when submitting a form · jonathanpmartins/symfony@a21950f · GitHub
[go: up one dir, main page]

Skip to content

Commit a21950f

Browse files
File upload is broken when submitting a form
...without selecting a file in Laravel 5! My tests revealed that with this tweek the problem described at this issue are resolved: laravel/framework#6189 ...in Symfony on the FileBag.php file, convertFileInformation() method returns NULL if no files was selected on the upload. In this case "FileBag->set('image', NULL)" receives NULL, and that is what is dispatching a throw! I don't make unit tests, but this will no more break my code flow. I'm not sure if this is the real deal! If someone could look deeper into the problem, I appreciated! | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | | License | MIT | Doc PR |
1 parent d94d837 commit a21950f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/HttpFoundation/FileBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function convertFileInformation($file)
9494

9595
if ($keys == self::$fileKeys) {
9696
if (UPLOAD_ERR_NO_FILE == $file['error']) {
97-
$file = null;
97+
$file = array();
9898
} else {
9999
$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']);
100100
}

0 commit comments

Comments
 (0)
0