laminas / laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria
https://docs.laminas.dev/laminas-validator/
BSD 3-Clause "New" or "Revised" License
128 stars 55 forks source link

Upload validator should be able to handle array of arrays returned by ServerRequestInterface::getUploadedFiles #159

Open InvisibleSmiley opened 1 year ago

InvisibleSmiley commented 1 year ago

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

Currently (I guess since version 2.11.0), the Upload validator can accept an array of UploadedFileInterface instances, but not an array of arrays of UploadedFileInterface instances. The latter is returned by ServerRequestInterface::getUploadedFiles if "array-indicating" file identifiers are used as multipart form parameter names (e.g. "file[]").

Note that the two variants can probably appear in a mixed fashion, i.e. the array returned by ServerRequestInterface::getUploadedFiles would contain both UploadedFileInterface instances and arrays of UploadedFileInterface instances.

icetee commented 1 year ago

The UploadFile validator only one file accepted. Maybe the problem is in the following place: https://github.com/laminas/laminas-inputfilter/blob/2.23.x/src/FileInput.php#L181