Permalink
Browse files

PHP 7.2: Fixed deprecated IDN variant

  • Loading branch information...
lukasbestle committed Oct 22, 2017
1 parent 88b001e commit 2786a1c1a0efc18b31d359c5a1263e7ea8a7260b
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/url.php
View
@@ -380,7 +380,8 @@ public static function idn($url) {
if(!function_exists('idn_to_utf8')) return $url;
// disassemble the URL, convert the domain name and reassemble
$host = idn_to_utf8(static::host($url));
$variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003;
$host = idn_to_utf8(static::host($url), 0, $variant);
if($host === false) return $url;
$url = static::build(['host' => $host], $url);
@@ -400,7 +401,8 @@ public static function unIdn($url) {
if(!function_exists('idn_to_ascii')) return $url;
// disassemble the URL, convert the domain name and reassemble
$host = idn_to_ascii(static::host($url));
$variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003;
$host = idn_to_ascii(static::host($url), 0, $variant);
if($host === false) return $url;
$url = static::build(['host' => $host], $url);

0 comments on commit 2786a1c

Please sign in to comment.