Zend Framework

Zend_Filter_Input::_validateRule() iterates through provided fields when it's not necessary

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.8.2
  • Component/s: Zend_Filter_Input
  • Labels:
    None

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).

Activity

Hide
Alexander Veremyev added a comment -

Fixed

Show
Alexander Veremyev added a comment - Fixed

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: