diff options
author | Andrey Andreev <narf@devilix.net> | 2018-06-12 15:25:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 15:25:44 +0200 |
commit | 9dfb18ce15e50521a1482f6610a2aeaa221b256c (patch) | |
tree | 85e66f27e44a710d9d71130dec15f1b9e310935b | |
parent | dc4a791ab07eeadb6f67eb26311c07199855390f (diff) | |
parent | 9bf6753a1bcd54d6ca69fc194efc9f982661aa66 (diff) |
Merge pull request #5510 from johndekroon/develop
Only use the output of idn_to_ascii() if it worked properly
-rw-r--r-- | system/libraries/Email.php | 12 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 55f81f4bd..d9da06057 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 ($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 ($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 106907289..bea51648e 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 ($domain !== FALSE) + { + $str = $matches[1].'@'.$domain; + } } return (bool) filter_var($str, FILTER_VALIDATE_EMAIL); |