I am confused with the following code and i would like to know what i am doing wrong. I use this code in Mezzio application
$inputFilter = new \Laminas\InputFilter\InputFilter(); $inputFilter->add([ 'name' => 'is_active', 'required' => false, 'filters' => [ [ 'name' => \Laminas\Filter\Boolean::class, 'type' => \Laminas\Filter\Boolean::TYPE_FALSE_STRING, ] ], ]); $data = ['is_active' => 'false']; $inputFilter->setData($data); $inputFilter->isValid();
And when I call : $inputFilter->getValues(); I obtain an array with ‘is_active’ value is true not false
And with :
$data = ['is_active' => false];
I obtain ‘isEmpty’ error message.
Does anyone have an explanation for this behavior? is this a bug? is my code wrong?
Thank you in advance for your answers