Added idn_to_ascii() with a check to make sure the function itself exists as well as a check for a required constant that it needs to function.

This commit is contained in:
Jabari 2018-01-05 22:28:47 -06:00
parent 28ef275cde
commit 8603b2bec3

View File

@ -511,6 +511,9 @@ class Validator
{ {
if ($this->validateEmail($field, $value)) { if ($this->validateEmail($field, $value)) {
$domain = ltrim(stristr($value, '@'), '@') . '.'; $domain = ltrim(stristr($value, '@'), '@') . '.';
if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46')) {
$domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
}
return checkdnsrr($domain, 'ANY'); return checkdnsrr($domain, 'ANY');
} }