ZF-3635: Zend_Validate_EmailAddress should not validateMx if hostname does not validate.

Issue Type: Improvement Created: 2008-07-13T01:37:11.000+0000 Last Updated: 2008-12-21T06:11:57.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Jérémy Lajotte (pengu) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:


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


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

     // MX check on hostname via dns_get_record()
     if ($this->_validateMx) {

Posted by Thomas Weidner (thomas) on 2008-12-08T12:20:42.000+0000

Implemented with r13101

Have you found an issue?

See the Overview section for more details.


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

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