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

Issue Type: Bug Created: 2007-09-06T04:52:49.000+0000 Last Updated: 2009-06-18T03:03:28.000+0000 Status: Resolved Fix version(s): - 1.8.2 (27/May/09)

Reporter: Laurent Melmoux (laurent melmoux) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Filter_Input

Related issues: - ZF-7034



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.

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

// Output
// Array ( [title] => Array ( [0] => '' is an empty string ) ) 


Posted by Bill Karwin (bkarwin) on 2007-10-17T15:28:42.000+0000

Changing to 'Unassigned'

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:29.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:54.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 Wil Sinclair (wil) on 2009-01-26T10:50:15.000+0000

Please evaluate and close this issue as appropriate.

Posted by Alexander Veremyev (alexander) on 2009-05-18T06:15:02.000+0000

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]

Posted by Alexander Veremyev (alexander) on 2009-05-22T08:13:57.000+0000


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.

Have you found an issue?

See the Overview section for more details.


© 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.