ZF2-493: setMessage() on email validator is not taken into account

Issue Type: Bug Created: 2012-08-22T22:57:00.000+0000 Last Updated: 2012-10-08T20:14:50.000+0000 Status: Closed Fix version(s): Reporter: Jurian Sluiman (mithras) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Validator

  • emailaddress
  • message
  • template
  • validator

Related issues: Attachments:


In an InputFilter instance the "message" option (which will call the Zend\Validator\EmailAddress::setMessage() ) does not get through when an error is made.

The root cause is because the Zend\Validator\AbstractValidator::setMessage() uses $this->abstractOptions['messageTemplates'] and the template keys are not the keys from the EmailAddress validator. Therefore when every template has set its own message, the real messages for the EmailAddress validator aren't set.

Possible test case:

<pre class="highlight">

    'name'       => 'email',
    'required'   => true,
    'validators' => array(
            'name'    => 'EmailAddress',
            'options' => array(
                'message' => 'This is not a valid email address'

For an InputFilter attached to a Form which has an element called "email". If tested with "a@@com" as input, seven errors occur of which none uses the set message.


Posted by Ralph Schindler (ralph) on 2012-10-08T20:14:50.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

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.