ZF-11142: Filter Input throws wrong not empty message error when validating
I couldn't find any previous bugs like this, so hopefully it's not a duplicate. The problem is that, if you have two validators where the first uses NotEmpty and the second one doesn't, it throws the NotEmpty error of the first.
Here's an example. Suppose you have these validators:
$validators = array( 'field1' => array( 'NotEmpty', 'Float', 'presence' => 'required', 'messages' => array( 'Field1 is empty', array( Zend_Validate_Float::NOT_FLOAT => "Field1 must be a number." ) ) ), 'field2' => array( 'presence' => 'required' ) );
Your input to this is a valid float for field1 and an empty string for field2. You run it through Zend_Filter_Input, and it doesn't validate. If you get the messages for field2, it'll return: [field1] => Array ( [isEmpty] => Field1 is empty. ) It also seems to ignore any defaults set in an $options for Zend_Filter_Input.
FWIW, my guess is the issue lies in Zend/Filter/Input.php::878-879.