diff --git a/common/framework/URL.php b/common/framework/URL.php index 6752eb99d..23e7f8f07 100644 --- a/common/framework/URL.php +++ b/common/framework/URL.php @@ -207,9 +207,13 @@ class URL */ public static function encodeIdna(string $url): string { - if (preg_match('@[:/#]@', $url)) + if (preg_match('@[:/#]@', $url) && !str_starts_with($url, '/')) { $domain = parse_url($url, \PHP_URL_HOST); + if (!$domain) + { + return $url; + } $position = strpos($url, $domain); if ($position === false) { @@ -243,9 +247,13 @@ class URL */ public static function decodeIdna(string $url): string { - if (preg_match('@[:/#]@', $url)) + if (preg_match('@[:/#]@', $url) && !str_starts_with($url, '/')) { $domain = parse_url($url, \PHP_URL_HOST); + if (!$domain) + { + return $url; + } $position = strpos($url, $domain); if ($position === false) {