UrlNormalize: Fix port normalization

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2019-05-13 19:08:47 +02:00
parent c7ba0ae3d1
commit 16e3b0bf07
1 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ class UrlNormalizer {
if (!isset($scheme) || $scheme === '') {
return $port;
}
if (isset($port) && $port !== '' && $port != self::DEFAULT_PORT[$scheme]) {
if (isset($port) && $port !== '' && ($scheme === self::DEFAULT_SCHEME || $port != self::DEFAULT_PORT[$scheme])) {
return $port;
}
return '';
@ -322,7 +322,7 @@ class UrlNormalizer {
}
}
$netloc = self::_clean_netloc($netloc);
if (strpos($netloc, ':') !== false && $netloc[strlen($netloc)-1] !== ']') {
if (strpos($netloc, ':') !== false && substr($netloc, strlen($netloc)-1, 1) !== ']') {
$host = substr($netloc, 0, strpos($netloc, ':'));
$port = substr($netloc, strpos($netloc, ':')+1);
} else {