Skip to content

Commit e8c49e6

Browse files
authored
Fix issue with double port in error pages base URL (OpenMage#4518)
* bugfix(errors): fix url issue were HTTP_HOST server var already includes port * bugfix(errors): use str_ends_with instead of substr_compare and run cs fixer
1 parent 31322c4 commit e8c49e6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

errors/processor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ public function getHostUrl(): string
185185
if (!empty($_SERVER['SERVER_PORT'])
186186
&& preg_match('/\d+/', $_SERVER['SERVER_PORT'])
187187
&& !in_array($_SERVER['SERVER_PORT'], [80, 433])
188+
&& !str_ends_with($host, ':' . $_SERVER['SERVER_PORT'])
188189
) {
189190
$url .= ':' . $_SERVER['SERVER_PORT'];
190191
}
192+
191193
return $url;
192194
}
193195

0 commit comments

Comments
 (0)