ZF-4379: Fail to validate empty array


It's possible to make an empty array pass as a valid Int or any other type of validation because the validation step is completly skip in Zend_Filter_Input.

<?php set_include_path('../library/ZendFramework/' . PATH_SEPARATOR . get_include_path());

require_once "Zend/Loader.php"; Zend_Loader::registerAutoload(); $validator = array( 'age' => array( 'presence' => 'required', 'Int' ) );

$data = array( 'age' => array() );

$input = new Zend_Filter_Input(null, $validator, $data, array(Zend_Filter_Input::ALLOW_EMPTY => false));

if ( $input->isValid() ) { echo 'Age '; var_dump($data['age']); echo ' is valid!'; } else { echo 'Age is not valid'; }


Fixed in revision #12430. Fix empty array validation with Zend_Filter_Input.

Changing issues in preparation for the 1.7.0 release.