Skip to content

Commit 422d244

Browse files
author
Logan Stellway
authored
Fix for #12969 - server port detection for errors
Updates `getHostUrl()` method to reference `HTTP_HOST` rather than `SERVER_PORT`.
1 parent 18dcf17 commit 422d244

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pub/errors/processor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,11 @@ public function getHostUrl()
268268
$isSecure = (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] != 'off');
269269
$url = ($isSecure ? 'https://' : 'http://') . $host;
270270

271-
if (!empty($_SERVER['SERVER_PORT']) && !in_array($_SERVER['SERVER_PORT'], [80, 443])
271+
$port = explode(':', $host);
272+
if (isset($port[1]) && !in_array($port[1], [80, 443])
272273
&& !preg_match('/.*?\:[0-9]+$/', $url)
273274
) {
274-
$url .= ':' . $_SERVER['SERVER_PORT'];
275+
$url .= ':' . $port[1];
275276
}
276277
return $url;
277278
}

0 commit comments

Comments
 (0)