laminas / laminas-inputfilter

Normalize and validate input sets from the web, APIs, the CLI, and more, including files
https://docs.laminas.dev/laminas-inputfilter/
BSD 3-Clause "New" or "Revised" License
42 stars 28 forks source link

`ArrayInput`: Accept non-array input without throwing an exception #105

Closed gsteel closed 6 months ago

gsteel commented 6 months ago

Description

Alters the behaviour of ArrayInput so that non-array input is deemed a validation failure instead of an exceptional condition.

Fixes #104

This could be considered a BC break, but it would never have previously been possible for a non-array value to be validated/filtered here, so it's more likely that no-one ever used this input type without wrapping its execution in a try/catch block.

Assuming users are using this input type, and they are wrapping with try, then the introduction of the IsArray validator will still provide graceful validation failure.

Ocramius commented 6 months ago

Marked as bug + improvement on purpose, BTW: it changes dependencies, so it can't go to a patch version

gsteel commented 6 months ago

Thankyou @Ocramius 🙏