From 2674bb4eb3ef26ff3408d0eb23b74373d2db0fb3 Mon Sep 17 00:00:00 2001 From: John de Kroon Date: Fri, 25 May 2018 11:46:27 +0200 Subject: Only use the output of idn_to_ascii() if it worked properly --- system/libraries/Form_validation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system/libraries/Form_validation.php') 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); -- cgit v1.2.3-24-g4f1b From 9bf6753a1bcd54d6ca69fc194efc9f982661aa66 Mon Sep 17 00:00:00 2001 From: John de Kroon Date: Mon, 11 Jun 2018 15:17:06 +0200 Subject: Fixing codestyle --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Form_validation.php') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 5c1c2e2e8..e14dc3168 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1240,7 +1240,7 @@ 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]); - //If idn_to_ascii() fails, treat it like it doesn't exists + if ($domain !== FALSE) { $str = $matches[1].'@'.$domain; -- cgit v1.2.3-24-g4f1b