From 7234794349829f0af03e4916b796d596302a3625 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Mon, 28 Aug 2017 12:26:22 +0200 Subject: [PATCH 1/3] strictly typecast port to int --- inc/SP/Core/Init.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/SP/Core/Init.class.php b/inc/SP/Core/Init.class.php index d616aecda..b2d876776 100644 --- a/inc/SP/Core/Init.class.php +++ b/inc/SP/Core/Init.class.php @@ -529,7 +529,7 @@ public static function isLoggedIn() private static function checkHttps() { if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) { - $port = ($_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; + $port = ((int)$_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; header('Location: ' . $fullUrl); } @@ -790,4 +790,4 @@ public static function checkPostLoginActions() return false; } -} \ No newline at end of file +} From 69a981bae54b2917f27398ac0c9b3f631dfd69be Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Mon, 28 Aug 2017 12:27:17 +0200 Subject: [PATCH 2/3] strictly typecast port to int --- inc/SP/Util/Checks.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/SP/Util/Checks.class.php b/inc/SP/Util/Checks.class.php index 47283532a..44fbe75d5 100644 --- a/inc/SP/Util/Checks.class.php +++ b/inc/SP/Util/Checks.class.php @@ -292,7 +292,7 @@ public static function httpsEnabled() { return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') - || $_SERVER['SERVER_PORT'] === 443; + || (int)$_SERVER['SERVER_PORT'] === 443; } /** @@ -315,4 +315,4 @@ public static function isJson() { return strpos(Request::getRequestHeaders('Accept'), 'application/json') === 0; } -} \ No newline at end of file +} From f3c8eab6fed1c47390e20de7a994a6f3f0229cd2 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Mon, 28 Aug 2017 12:28:07 +0200 Subject: [PATCH 3/3] strictly typecast port to int --- inc/SP/Util/Util.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 1d57143c3..ead17e5cb 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -537,7 +537,7 @@ public static function arrayJSEscape(&$array) public static function getServerUrl() { $urlScheme = Checks::httpsEnabled() ? 'https://' : 'http://'; - $urlPort = ($_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; + $urlPort = ((int)$_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; return $urlScheme . $_SERVER['SERVER_NAME'] . $urlPort; } @@ -678,4 +678,4 @@ public static function getClientAddress($fullForwarded = false) return $_SERVER['REMOTE_ADDR']; } -} \ No newline at end of file +}