ZF-12496: Zend_Validate_Identical don't launches if form element value is empty

Issue Type: Bug Created: 2013-01-03T14:57:46.000+0000 Last Updated: 2013-01-03T16:13:29.000+0000 Status: Resolved Fix version(s): Reporter: Anton Zelenski (zelibobla) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Validate

  • Zend_Validate_Identical

Related issues: Attachments:


Assume we have two form fields: password and password_repeat. Both of it is not required. The last one has attached Zend_Validate_Identical validator (token parameter points to password form field). In case when values (password:'12345',password_repeat:'1') passed - anything works great. But if to pass (password:'12345',password_repeat:'') form has success validation. It looks like since password_repeat form element has no any data submitted no any validation launches at all. I am not sure if it is exactly Zend_Validation_Identical class bug against Zend_Form::isValid mechanism. Anyway, '' is not identical to '12345', thus form shouldn't be validated successfully.


Posted by Matthew Weier O'Phinney (matthew) on 2013-01-03T15:12:27.000+0000

If the field is not required, and no value is provided, validators are not checked. As such, you need to either (a) mark it as required, or (b) create a custom validator that checks if the "password" field is non-empty and only then runs the Identical validator.

Posted by Anton Zelenski (zelibobla) on 2013-01-03T16:13:29.000+0000

Yes, thank you. There are also another ways to solve the trouble.

I guess this is a question of logic not a bug exactly. In described case non-required form field with no value provided needed validator to be launched though.

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.