summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2018-01-22 09:29:19 +0100
committerAndrey Andreev <narf@devilix.net>2018-01-22 09:29:19 +0100
commit221c09588be796ba352683cd7814af33501d4fa6 (patch)
tree69b91a9315502b9387e0931b6c9cbd249e6c0609 /system/libraries
parent5a0f04e232c3f2c681b99ba6f0a8e383303ec296 (diff)
Fix a bug where INTL_IDNA_VARIANT_UTS46 was used while undeclared
The constant was introduced in PHP 5.4, and is documented that way, but it actually depends on PHP being linked to ICU 4.6+, while the minimum requirement for compilation is 4.0 ... When this happens on PHP 7.2, an E_DEPRECATED notice will be emitted; there's currently a discussion on php-internals to resolve that issue.
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Email.php2
-rw-r--r--system/libraries/Form_validation.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 6a8bda70e..967a0019a 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1035,7 +1035,7 @@ class CI_Email {
if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
list($account, $domain) = explode('@', $email, 2);
- $domain = is_php('5.4')
+ $domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($domain);
$email = $account.'@'.$domain;
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 3444c65a0..6a97ee599 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1231,7 +1231,7 @@ class CI_Form_validation {
{
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
{
- $domain = is_php('5.4')
+ $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;