From 8603b2bec385fc6c7cfd27c73280ee06f0164d95 Mon Sep 17 00:00:00 2001 From: Jabari Date: Fri, 5 Jan 2018 22:28:47 -0600 Subject: [PATCH] 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. --- src/Valitron/Validator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index f085bb5..4eae399 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -511,6 +511,9 @@ class Validator { if ($this->validateEmail($field, $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'); }