Fix url() function

This commit is contained in:
Visman 2023-07-31 17:44:25 +07:00
parent 5a7ef2003e
commit 39309de302

View file

@ -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)
) {