Issues

ZF-4939: Zend_Validate gets error codes from messages keys (not from errors), Zend_Validate_EmailAddress doesnt set error keys for messages at all

Issue Type: Bug Created: 2008-11-13T05:03:56.000+0000 Last Updated: 2008-12-21T06:19:06.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Vladas Dirzys (funkyfly) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:

Description

Following code: $validators = new Zend_Validate(); $validators->addValidator(new Zend_Validate_EmailAddress()); $validators->isValid('www@<www.ww>'); Zend_Debug::dump($validators->getErrors());

Returns: array(3) { ["emailAddressInvalidHostname"] => string(63) "'<www.ww>' is not a valid hostname for email address 'www@<www.ww>'" [0] => string(77) "'<www.ww>' appears to be a DNS hostname but cannot match TLD against known list" [1] => string(83) "'<www.ww>' appears to be a local network name but local network names are not allowed" }

the errors codes are missing.

The bug is in class Zend_Validate because it gets the error codes from error messages keys and not from $validator->getErrors() $messages = $validator->getMessages(); $this->_messages = array_merge($this->_messages, $messages); $this->_errors = array_merge($this->_errors, array_keys($messages));

and also in class Zend_Validate_EmailAddress: // Get messages and errors from hostnameValidator foreach ($this->hostnameValidator->getMessages() as $message) { $this->_messages[] = $message; } where the validator doesn't set the error messages keys and IMO it should look like this: // Get messages and errors from hostnameValidator foreach ($this->hostnameValidator->getMessages() as $error => $message) { $this->_messages[$error] = $message; }

Comments

Posted by Thomas Weidner (thomas) on 2008-12-09T06:05:27.000+0000

Fixed with r13113

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts