From 4541bf930e715917622dc2d225bf5517f99db35a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 9 Nov 2017 17:27:59 +0200 Subject: [ci skip] Fix patch for #5300 --- system/libraries/Email.php | 4 ++-- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 48726b769..3b1da8de0 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1037,7 +1037,7 @@ class CI_Email { if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) { $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); + $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, $variant); } return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); @@ -1855,7 +1855,7 @@ class CI_Email { if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) { $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); + $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, $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 1619ec9a9..cd1d4a759 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1232,7 +1232,7 @@ class CI_Form_validation { if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches)) { $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; - $str = $matches[1].'@'.idn_to_ascii($matches[2], $variant); + $str = $matches[1].'@'.idn_to_ascii($matches[2], 0, $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 1793108d8..eb879c5a8 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -9,8 +9,8 @@ Release Date: Not Released - General Changes - - Updated :doc:`Form Validation Library ` rule ``valid_email`` to use ``INTL_IDNA_VARIANT_UCS46`` for non-ASCII domain names. - - Updated :doc:`Email Library ` to use ``INTL_IDNA_VARIANT_UCS46`` for non-ASCII domain names. + - Updated :doc:`Form Validation Library ` rule ``valid_email`` to use ``INTL_IDNA_VARIANT_UTS46`` for non-ASCII domain names. + - Updated :doc:`Email Library ` to use ``INTL_IDNA_VARIANT_UTS46`` for non-ASCII domain names. - Deprecated usage of :doc:`CAPTCHA Helper ` function :php:func:`create_captcha()` with parameters other than ``$data``. Bug fixes for 3.1.7 -- cgit v1.2.3-24-g4f1b