Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #24198 [HttpFoundation] Fix file upload multiple with no files (e…
…numag) This PR was merged into the 2.7 branch. Discussion ---------- [HttpFoundation] Fix file upload multiple with no files | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | ```php <form method="post" enctype="multipart/form-data"> <input type="file" multiple name="img[]"> <input type="submit"> </form> <?php $loader = require __DIR__ . '/../app/autoload.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); var_export($request->files->all()['img']); } ``` Expected result when I send the form without any files: ``` array () ``` Actual result: ``` array ( 0 => NULL, ) ``` This causes a problem later when using FileType with multiple option - if no files are sent the form data are `[0 => '']` instead of `[]`. Of course I need to add a test for this. Commits ------- d4f6039 [HttpFoundation] Fix file upload multiple with no files
- Loading branch information