This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -449,7 +449,14 @@ private function _validateLocalPart()
449
449
private function _validateMXRecords ()
450
450
{
451
451
$ mxHosts = array ();
452
- $ result = getmxrr ($ this ->_hostname , $ mxHosts );
452
+ $ hostname = $ this ->_hostname ;
453
+
454
+ //decode IDN domain name if possible
455
+ if (function_exists ('idn_to_ascii ' )) {
456
+ $ hostname = idn_to_ascii ($ this ->_hostname );
457
+ }
458
+
459
+ $ result = getmxrr ($ hostname , $ mxHosts );
453
460
if (!$ result ) {
454
461
$ this ->_error (self ::INVALID_MX_RECORD );
455
462
} else if ($ this ->_options ['deep ' ] && function_exists ('checkdnsrr ' )) {
Original file line number Diff line number Diff line change @@ -622,6 +622,19 @@ public function testNotSetHostnameValidator()
622
622
$ hostname = $ this ->_validator ->getHostnameValidator ();
623
623
$ this ->assertTrue ($ hostname instanceof Zend_Validate_Hostname);
624
624
}
625
+
626
+ /**
627
+ * @group GH-62
628
+ */
629
+ public function testIdnHostnameInEmaillAddress ()
630
+ {
631
+ if (version_compare (PHP_VERSION , '5.3.0 ' , '< ' )) {
632
+ $ this ->markTestSkipped ('idn_to_ascii() is available in intl in PHP 5.3.0+ ' );
633
+ }
634
+ $ validator = new Zend_Validate_EmailAddress ();
635
+ $ validator ->setValidateMx (true );
636
+ $ this ->assertTrue ($ validator ->isValid ('testmail@detrèsbonsdomaines.com ' ));
637
+ }
625
638
}
626
639
627
640
if (PHPUnit_MAIN_METHOD == 'Zend_Validate_EmailAddressTest::main ' ) {
You can’t perform that action at this time.
0 commit comments