summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index f402459a9..9e4c81c61 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1237,7 +1237,10 @@ class CI_Form_validation {
{
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
{
- $str = $matches[1].'@'.idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46);
+ $domain = defined('INTL_IDNA_VARIANT_UTS46')
+ ? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
+ : idn_to_ascii($matches[2]);
+ $str = $matches[1].'@'.$domain;
}
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);