ZF-2432: Zend_Validate validators do not all set messages

Issue Type: Bug Created: 2008-01-14T13:11:40.000+0000 Last Updated: 2008-03-21T16:25:50.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Matthew Weier O'Phinney (matthew) Assignee: Darby Felton (darby) Tags: - Zend_Validate

Related issues: Attachments:


A number of Zend_Validate concrete validators do not currently set the $_messages array on a failed isValid() call, which means that if you call getMessages() after a failed validation, it may return an empty result. This is problematic when using a validator chain (such as Zend_Validate, or the new Zend_Form component), as the results of getMessages() becomes unpredictable.

Validators known to be missing this functionality include: * Digits * Alnum

Additionally, it would be useful to have the returned array use the error code for the key, such that getMessages() would return array( CODE => ).


Posted by Darby Felton (darby) on 2008-01-14T16:19:09.000+0000

Would you please provide some test data from which I can reproduce the behavior of getMessages() returning an empty array for each of the above listed classes? Thanks! :)

Posted by Darby Felton (darby) on 2008-01-15T11:23:18.000+0000

I haven't been able to reproduce the described problem with getMessages() not returning validation failure messages for either listed class, but I have added unit tests to cover the case for some basic input.

I am making the change that getMessages() returns an array such that:

<pre class="highlight">
assert($validator->getErrors() === array_keys($validator->getMessages()));

This allows us to deprecate the superfluous getErrors() method from the validation interface.

Posted by Darby Felton (darby) on 2008-01-15T16:42:54.000+0000

Resolving as cannot reproduce, having committed SVN r7450.

Have you found an issue?

See the Overview section for more details.


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

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