ZF-6765: Zend_Filter_Input::_validateRule() iterates through provided fields when it's not necessary
Description
Zend_Filter_Input::_validateRule() has the following code:
/**
* Evaluate the inputs against the validator chain.
*/
if (count((array) $validatorRule[self::FIELDS]) > 1) {
....
} else {
$failed = false;
foreach ($data as $fieldKey => $field) {
....
}
....
}
But $data cardinality is always less than (array) $validatorRule[self::FIELDS] cardinality since $data elements are collected by iterating through it.
It's not a bug, but it reduces code readability ($data is always one element array).
Comments
Posted by Alexander Veremyev (alexander) on 2009-05-22T06:12:45.000+0000
Fixed