summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-10-16 10:05:58 +0200
committerAndrey Andreev <narf@devilix.net>2017-10-16 10:05:58 +0200
commitd282d07dfba94b5395d1dd989bdb958c972bb7cf (patch)
treecd50ef683b8d425057c0d50fc5cd1316d8474e85 /system/libraries/Email.php
parentfa2a0c58eb0f6421e3819df8a8873b5a5e4ebb58 (diff)
[ci skip] Use INTL_IDNA_VARIANT_UCS46 to convert non-ASCII domain names in emails
Close #5300
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php6
1 files changed, 4 insertions, 2 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));