ZF-3635: Zend_Validate_EmailAddress should not validateMx if hostname does not validate.
Description
If the hostname validation failled, I think it's useless to check for MX records. Plus, it produce too much errors. For exemple : using an email like name@IP using the default Zend_Validate_Hostname::ALLOW_DNS and setting $validateMx to true, will produce 3 errors : Zend_Validate_EmailAddress::INVALID_HOSTNAME Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED Zend_Validate_EmailAddress::INVALID_MX_RECORD
That last error should be avoid : since the domain name is not valid, why would we want to check if an MX record exists for this invalid domain name?
Or, if I miss a point, we should at least have an option like the $breakChainOnFailure used inside the Zend_Validate_EmailAddress
Comments
Posted by Jérémy Lajotte (pengu) on 2008-07-13T01:38:22.000+0000
Index: ZendFramework/1.5.2/library/Zend/Validate/EmailAddress.php
--- ZendFramework/1.5.2/library/Zend/Validate/EmailAddress.php (revision 5) +++ ZendFramework/1.5.2/library/Zend/Validate/EmailAddress.php (working copy) @@ -187,7 +187,7 @@ foreach ($this->hostnameValidator->getErrors() as $error) { $this->_errors[] = $error; } - } + } else
Posted by Thomas Weidner (thomas) on 2008-12-08T12:20:42.000+0000
Implemented with r13101