summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorJohn de Kroon <john.de.kroon@cyberant.nl>2018-05-25 11:46:27 +0200
committerJohn de Kroon <john.de.kroon@cyberant.nl>2018-05-25 11:46:27 +0200
commit2674bb4eb3ef26ff3408d0eb23b74373d2db0fb3 (patch)
treebf5ef6564f679b3fa648c9679660369708f88457 /system/libraries/Email.php
parente837b9b8705c222d49f86ab051d2df717d986c5b (diff)
Only use the output of idn_to_ascii() if it worked properly
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index beb2ffa17..cbfd670e7 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1017,7 +1017,11 @@ class CI_Email {
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($matches[2]);
- $email = $matches[1].'@'.$domain;
+ //If idn_to_ascii() fails, treat it like it doesn't exists
+ if ($domain !== FALSE)
+ {
+ $email = $account.'@'.$domain;
+ }
}
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
@@ -1828,7 +1832,11 @@ class CI_Email {
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($domain);
- $email = $account.'@'.$domain;
+ //If idn_to_ascii() fails, treat it like it doesn't exists
+ if ($domain !== FALSE)
+ {
+ $email = $account.'@'.$domain;
+ }
}
return (filter_var($email, FILTER_VALIDATE_EMAIL) === $email && preg_match('#\A[a-z0-9._+-]+@[a-z0-9.-]{1,253}\z#i', $email));