Issues

ZF-7727: Format of the message key not the same for a missing field in Zend_Filter_Input

Description

When a field is missing, the messages returned as an array is of the following form (with '0' as the key of the message) :

 
Array
(
    [DATE_DAY] => Array
        (
            [0] => Field 'DATE_DAY' is required by rule 'DATE_DAY', but the field is missing
        )
)

Whereas the list of messages for an empty field or any other validation errors will look like (with the name of the validation rule as the key of each message) :

 
[Array
(
    [DATE_DAY] => Array
        (
            [isEmpty] => You must give a non-empty value for field 'DATE_DAY'
        )
)

Array
(
    [DATE_DAY] => Array
        (
            [notDigits] => 'a' contains not only digit characters
            [notBetween] => 'a' is not between '1' and '31', inclusively
        )
)

So I guess the key of the message for a missing field should follow the same pattern and be something like 'isRequired'.

Comments

Only the messages which are directly from an validator are returned with an "speaking" array key. Any self defined message and also the "element missing" message from the filter itself is attached to the validator key.

When you have 2 validators then the second would have the array key 1, even if the first validator did not throw an error. According to the manual the numeric key defines the validator-number.