Skip to content

Commit

Permalink
Cast SERVER_PORT to integer
Browse files Browse the repository at this point in the history
  • Loading branch information
timsmid committed Dec 15, 2023
1 parent 7be38be commit 62dc440
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]

### Fixed
- Cast `$_SERVER['SERVER_PORT']` to integer to prevent adding 80 or 443 port to redirect URL. #403

## [1.0.0] - 2023-12-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public function getRedirectURL(): string
if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
$port = (int)$_SERVER['HTTP_X_FORWARDED_PORT'];
} elseif (isset($_SERVER['SERVER_PORT'])) {
$port = $_SERVER['SERVER_PORT'];
$port = (int)$_SERVER['SERVER_PORT'];
} elseif ($protocol === 'https') {
$port = 443;
} else {
Expand Down

0 comments on commit 62dc440

Please sign in to comment.