I would say both. :-)))
Please fill out an issue in jira so we can solve this bug.
framework.zend.com/issues
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "Vladas Diržys" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Thursday, November 13, 2008 9:24 AM
Subject: [fw-general] Zend_Validate or Zend_Validate_EmailAddress BUG
Hello,
I try to validate email address with wrong hostname([EMAIL PROTECTED]) and the
validator returns following errors:
array(3) {
["emailAddressInvalidHostname"] => string(63) "'www.ww' is not a valid
hostname for email address '[EMAIL PROTECTED]'"
[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"
}
code I used:
$validators = new Zend_Validate();
$validators->addValidator(new Zend_Validate_EmailAddress());
$validators->isValid('[EMAIL PROTECTED]');
Zend_Debug::dump($validators->getErrors());
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));
or 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;
}
or in both classes ;-)
--
Pagarbiai,
Vladas Diržys
Tel.: +370 620 69020
www.dirzys.com