Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
PHP 7.2: Fixed deprecated IDN variant
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle committed Oct 22, 2017
1 parent 88b001e commit 2786a1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 2786a1c

Please sign in to comment.