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


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:

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


This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2538