diff options
-rw-r--r-- | system/libraries/Email.php | 6 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 3 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 5 |
3 files changed, 11 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 0e9cf0574..48726b769 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1036,7 +1036,8 @@ class CI_Email { { if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) { - $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos)); + $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; + $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), $variant); } return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); @@ -1853,7 +1854,8 @@ class CI_Email { { if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) { - $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos)); + $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; + $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), $variant); } return (filter_var($email, FILTER_VALIDATE_EMAIL) === $email && preg_match('#\A[a-z0-9._+-]+@[a-z0-9.-]{1,253}\z#i', $email)); diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 71d0e64b1..1619ec9a9 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1231,7 +1231,8 @@ class CI_Form_validation { { if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches)) { - $str = $matches[1].'@'.idn_to_ascii($matches[2]); + $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; + $str = $matches[1].'@'.idn_to_ascii($matches[2], $variant); } return (bool) filter_var($str, FILTER_VALIDATE_EMAIL); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index d222e17fb..647fe4817 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -7,6 +7,11 @@ Version 3.1.7 Release Date: Not Released +- General Changes + + - Updated :doc:`Form Validation Library <libraries/form_validation>` rule ``valid_email`` to use ``INTL_IDNA_VARIANT_UCS46`` for non-ASCII domain names. + - Updated :doc:`Email Library <libraries/email>` to use ``INTL_IDNA_VARIANT_UCS46`` for non-ASCII domain names. + Bug fixes for 3.1.7 ------------------- |