Closed gsteel closed 5 months ago
I would expect that using an ArrayInput with InputFilter to fail validation when given non-array input, but instead an exception is thrown.
ArrayInput
InputFilter
Given that the whole idea is filtering and validation of untrusted input, causing a crash in this situation seems odd to me.
$inputFilter = new InputFilter(); $inputFilter->add([ 'type' => ArrayInput::class, 'validators' => [ ['name' => NotEmptyValidator::class], ], ], 'myInput'); $inputFilter->setData(['myInput' => 'Whatever']); // Exception thrown here. assert($inputFilter->isValid() === false);
I would expect that using an
ArrayInput
withInputFilter
to fail validation when given non-array input, but instead an exception is thrown.Given that the whole idea is filtering and validation of untrusted input, causing a crash in this situation seems odd to me.