|
|
|
@ -67,9 +67,13 @@ class UrlHelper {
|
|
|
|
|
//convert IDNA hostname to punycode if possible
|
|
|
|
|
if (function_exists("idn_to_ascii")) {
|
|
|
|
|
if (mb_detect_encoding($tokens['host']) != 'ASCII') {
|
|
|
|
|
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']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// separate set of tokens with urlencoded 'path' because filter_var() rightfully fails on non-latin characters
|
|
|
|
|
// (used for validation only, we actually request the original URL, in case of urlencode breaking it)
|
|
|
|
|