Zend Framework

ALLOW_EMPTY ignored when validating multiple fields

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.0.2
  • Fix Version/s: None
  • Component/s: Zend_Filter_Input
  • Labels:
    None

Description

The value of ALLOW_EMPTY is not checked if there are mutliple fields to be validated.

require_once 'Zend/Filter/Input.php';
require_once 'Zend/Validate/Abstract.php';

class Zend_Validate_AlwaysFails extends Zend_Validate_Abstract {
public function isValid($values) { return false; }
}

$fails = new Zend_Validate_AlwaysFails();

$input = new Zend_Filter_Input(
array(),
array(
'test' => array(
$fails,
'allowEmpty' => true
'fields' => array('one', 'two')
)
),
array(
'one' => '',
'two' => ''
)
);

var_dump($input->isValid());

This should return true, but returns false because allow empty is ignored.

Issue Links

Activity

Hide
Justin Hendrickson added a comment -

Simple patch I whipped up to fix the problem.

Show
Justin Hendrickson added a comment - Simple patch I whipped up to fix the problem.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: