Skip to content

Commit e31ec33

Browse files
authored
fix: Cast SERVER_PORT to integer (#404)
1 parent f5fadf1 commit e31ec33

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
- Updated CI to also test on PHP 8.3 #407
99
- Updated readme PHP requirement to PHP 7.0+ #407
1010
- Added dependabot for GitHub Actions #407
11+
- Cast `$_SERVER['SERVER_PORT']` to integer to prevent adding 80 or 443 port to redirect URL. #403
1112

1213
## [1.0.0] - 2023-12-13
1314

src/OpenIDConnectClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ public function getRedirectURL(): string
696696
if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
697697
$port = (int)$_SERVER['HTTP_X_FORWARDED_PORT'];
698698
} elseif (isset($_SERVER['SERVER_PORT'])) {
699-
$port = $_SERVER['SERVER_PORT'];
699+
$port = (int)$_SERVER['SERVER_PORT'];
700700
} elseif ($protocol === 'https') {
701701
$port = 443;
702702
} else {

0 commit comments

Comments
 (0)