Issues

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

Issue Type: Bug Created: 2009-08-31T01:25:55.000+0000 Last Updated: 2009-08-31T10:27:37.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: St├ęphane (stephane) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter_Input

Related issues: Attachments:

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) :

<pre class="highlight"> 
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) :

<pre class="highlight"> 
[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

Posted by Thomas Weidner (thomas) on 2009-08-31T10:27:17.000+0000

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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts