Zend Framework

Validation problem with array elements

Details

  • Type: Patch Patch
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.5.2
  • Component/s: Zend_Form
  • Labels:
    None
  • Fix Version Priority:
    Must Have

Description

There seems to be a mistake on the isValid method of the Zend_Form_Element class.
The validation is performed twice for array's elements.
Each items of the array are validated, then the array is validated too.

Suggested fix :
Prepend the "else" keyword on the line 1203 on revision 9215 :

else if ($validator->isValid($value, $context)) {

Then the problem will be solved with the classical test :

public function isValid($value, $context = null)
{
    ...
    foreach ($this->getValidators() as $key => $validator) {
        ...
        if ($isArray && is_array($value))
            ...
        else if ($validator->isValid($value, $context))
            ...
        else
            ...
        ...
    }
    ...
}

Greetings.

Activity

Hide
Wil Sinclair added a comment -

Please evaluate and categorize as necessary.

Show
Wil Sinclair added a comment - Please evaluate and categorize as necessary.
Hide
Matthew Weier O'Phinney added a comment -

Scheduling for next mini release.

Show
Matthew Weier O'Phinney added a comment - Scheduling for next mini release.
Hide
Matthew Weier O'Phinney added a comment -

Resolved in both trunk and 1.5 release branch as of r9315.

Show
Matthew Weier O'Phinney added a comment - Resolved in both trunk and 1.5 release branch as of r9315.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
30m
Original Estimate - 30 minutes
Remaining:
30m
Remaining Estimate - 30 minutes
Logged:
Not Specified
Time Spent - Not Specified