From 328d7b55c8cb4d56492356a73df19f7c59784d82 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 14 Nov 2020 15:13:35 +0300 Subject: [PATCH] URLHelper: fix E_DEPRECATED error related to idn_to_ascii() --- classes/urlhelper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/urlhelper.php b/classes/urlhelper.php index d7b7d004a..cc1074c55 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -67,7 +67,11 @@ class UrlHelper { //convert IDNA hostname to punycode if possible if (function_exists("idn_to_ascii")) { if (mb_detect_encoding($tokens['host']) != 'ASCII') { - $tokens['host'] = idn_to_ascii($tokens['host']); + if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) { + $tokens['host'] = idn_to_ascii($tokens['host'], IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); + } else { + $tokens['host'] = idn_to_ascii($tokens['host']); + } } }