php-pm / php-pm-httpkernel

HttpKernel adapter for use of Symfony and Laravel frameworks with PHP-PM
MIT License
246 stars 72 forks source link

Fix empty file inputs in Symfony 4.1 #116

Closed mathieudz closed 6 years ago

mathieudz commented 6 years ago

Symfony 4.1 fails on uploaded files that are null: they must be array or UploadedFile. UploadedFile can only be used for actual files. Solution is to pass the uploaded file as array instead.

The array cannot be passed for actual uploaded files because Symfony will not trust the files because they were not created by PHP core.

A better solution would be to let Symfony accept null files (see implementation of FileBag).

andig commented 6 years ago

This should fix https://github.com/php-pm/php-pm-httpkernel/issues/111

mathieudz commented 6 years ago

Indeed, that's the error I had. How to reproduce: add a file input to a form and submit without specifying a file. HttpKernel replaces the React file by null and Symfony will not accept it.

andig commented 6 years ago

Much appreciated, thank you!