ZF-7673: Zend_Validate_Regex uses incorrect message template


h4. Code to reproduce error In the output of the code fragment below is visible that {{Zend_Validate_Regex}} uses {{Zend_Validate_Regex::INVALID}} message template, instead of {{Zend_Validate_Regex::NOT_MATCH}} template.

$validator = new Zend_Validate_Regex('/^\d+$/');
if(!$validator->isValid('this is not digit'))
    foreach($validator->getMessages() as $message)
        $message_template = $validator->getMessageTemplates();
        $message_template = $message_template[Zend_Validate_Regex::NOT_MATCH];
        echo $message_template;
        echo "\n
"; echo $message; } }

h4. The cause {{$this->_error()}} call (at line 120) in {{Zend_Validate_Regex::isValid}} function uses first available message template, which in this case is {{Zend_Validate_Regex::INVALID}}.

h4. The solution: in {{Zend_Validate_Regex::isValid}} function instead of lines (119-122), just before last return statement

if (!$status) {
    return false;

should be

if (!$status) {
    return false;


This is a duplication of an existing issue and has already been fixed with ZF 1.9.2