ZF-1859: allowEmpty = false is ineffective if input rule has multiple fields
Description
Issue reported by Jim Scherer.
Below is code to demonstrate the failure:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
$filters = array( );
$validators = array(
'test' => array(
'allowEmpty' => false,
'fields' => array( 'empty', 'notempty' )
)
);
$data = array(
'empty' => '',
'notempty' => 'not empty'
);
$input = new Zend_Filter_Input( $filters, $validators, $data );
// expect input to be invalid
echo "\ninput->isValid =\n";
var_dump($input->isValid());
echo "\nvalidators =\n";
var_dump($validators);
// echo "\ninput object =\n";
// echo var_dump($input);
echo "\nempty(data[empty]) =\n";
var_dump(empty($data['empty']));
echo "\nempty(data[notempty]) =\n";
var_dump(empty($data['notempty']));
Comments
Posted by Bill Karwin (bkarwin) on 2007-08-16T14:50:53.000+0000
Confirmed that {{isValid()}} returns {{true}}, which is wrong for the example case above.
Posted by Bill Karwin (bkarwin) on 2007-10-17T15:28:44.000+0000
Changing to 'Unassigned'
Posted by Wil Sinclair (wil) on 2008-03-21T17:05:33.000+0000
This issue should have been fixed for the 1.5 release.
Posted by Wil Sinclair (wil) on 2008-04-18T13:11:51.000+0000
This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
Posted by Wil Sinclair (wil) on 2008-04-18T16:58:29.000+0000
Please evaluate and categorize/assign as necessary.
Posted by Benjamin Eberlei (beberlei) on 2009-01-07T15:49:58.000+0000
I will spend some time on it later this week.
Posted by Thomas Weidner (thomas) on 2009-08-25T13:15:14.000+0000
Running the above code on actual trunk I get the expected and wished result. Closing this issue as fixed for the next release as I'm unsure when it was really fixed.