ZF-1912: Message concurrency between options notEmptyMessage and Zend_Validate_Alpha::STRING_EMPTY

Description

I'm not sure if it's the correct behavior or not but if you set notEmptyMessage in the options array and you use a validation rule which handle empty message like Zend_Validate_Alpha the "generic" message notEmptyMessage will not be use in favor of which handle Zend_Validate_Alpha::STRING_EMPTY.

By setting notEmptyMessage in the options I was expecting to have the same message for all empty value.


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

$validators = array(
    'title' => array('Alpha', 'presence' => 'required')
);

$options = array(
    'missingMessage'  => "Le champ '%field%' est manquant",
    'notEmptyMessage' => "Le champ '%field%' est requis"
);

$input = new Zend_Filter_Input(null, $validators, $data, $options);

print_r($input->getMessages());
// Output
// Array ( [title] => Array ( [0] => '' is an empty string ) ) 

Comments

Changing to 'Unassigned'

This issue should have been fixed for the 1.5 release.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Please evaluate and categorize/assign as necessary.

Please evaluate and close this issue as appropriate.

There are actually a set of additional issues: * Zend_Filter_Input skips ALLOW_EMPTY metacommand processing if any validator is applied to the field - [ZF-6708]; * Zend_Filter_Input doesn't process messages -> validators mapping correctly - [ZF-6709]. * Zend_Filter_Input skips ALLOW_EMPTY metacommand processing if rule refers several fields - [ZF-6711] * Zend_Filter_Input skips validators processing if ALLOW_EMPTY metacommand is set to true - [ZF-6713]

Fixed.

ALLOW_EMPTY overrides other validators processing now. The same behavior is described in the documentation.

Empty fields are never processed by rule validators. If field is empty and it's allowed, then other validators processing is skipped. If field is empty and it's not allowed, then corresponding message is set.