summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.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/Form_validation.php
parente837b9b8705c222d49f86ab051d2df717d986c5b (diff)
Only use the output of idn_to_ascii() if it worked properly
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php6
1 files changed, 5 insertions, 1 deletions
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);