From 84949975b0ebf8fe92acfe6e61aaff18ec112caa Mon Sep 17 00:00:00 2001 From: "M.Martellenghi" Date: Mon, 17 Dec 2018 13:09:44 +0100 Subject: [PATCH] Proberly handle hostnames with ports in `Pico::getBaseUrl()` (#472) * fixed getting current port from current host Resolves #472 --- lib/Pico.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Pico.php b/lib/Pico.php index c69f6dca7..0a52e6b1c 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -2054,8 +2054,8 @@ public function getBaseUrl() $hostPortPosition = ($host[0] === '[') ? strpos($host, ':', strrpos($host, ']') ?: 0) : strrpos($host, ':'); if ($hostPortPosition !== false) { - $host = substr($host, 0, $hostPortPosition); $port = (int) substr($host, $hostPortPosition + 1); + $host = substr($host, 0, $hostPortPosition); } $protocol = 'http';