Zend performs validation for Zend_Filter_Input recursively, so the code:
$data = array(
'update' => array(1, 2, 3)
);
$validators = array(
'update' => array(
new Zend_Validate_Callback('is_array'),
'presence' => 'required'
)
);
$filter = new Zend_Filter_Input(array(), $validators, $data);
var_dump($filter->isValid());
var_dump($filter->getMessages());
returns false and messages that 1, 2 and 3 aren't valid values.
Any ways to validate if a value is array, without recursive rule applying?
$data = array( 'update' => array(array(1, 2, 3)) );?Zend_Filter_Inputsource, on :1011 it makes field value an array in case if it's not, andforeachover it on :1024. So I'm guessing the only solution will be to extendZend_Filter_Input, or wrap value in array as suggested before ?is_array().Zend_Filter_Inputperforms recursive traversing, so a particular validator can nothing to do with it