summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Email.php12
-rw-r--r--system/libraries/Form_validation.php6
2 files changed, 15 insertions, 3 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));
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 9e4c81c61..5c1c2e2e8 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1240,7 +1240,11 @@ class CI_Form_validation {
$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;
+ //If idn_to_ascii() fails, treat it like it doesn't exists
+ if ($domain !== FALSE)
+ {
+ $str = $matches[1].'@'.$domain;
+ }
}
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);