From 39309de302673d6dee2a474214f8e0b2cb2a184a Mon Sep 17 00:00:00 2001 From: Visman Date: Mon, 31 Jul 2023 17:44:25 +0700 Subject: [PATCH] Fix url() function --- app/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/functions.php b/app/functions.php index 7b206aee..6785dbe6 100644 --- a/app/functions.php +++ b/app/functions.php @@ -264,10 +264,11 @@ function url(string $url): string $host = \filter_var($p['host'], \FILTER_VALIDATE_DOMAIN, \FILTER_FLAG_HOSTNAME); - if (false !== $host) { + if (\is_string($host)) { $result .= $host; } elseif ( - '[' === $p['host'][0] + isset($p['host'][1]) + && '[' === $p['host'][0] && ']' === $p['host'][-1] && \filter_var(\substr($p['host'], 1, -1), \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6) ) {