Upgrade to 3.6.0

This commit is contained in:
Bastian Allgeier
2021-11-16 14:53:37 +01:00
parent 7388fa4d24
commit 92b7a330fa
318 changed files with 20017 additions and 6878 deletions

View File

@@ -119,13 +119,21 @@ class Server
*/
public static function port(bool $forwarded = false): int
{
$port = $forwarded === true ? static::get('HTTP_X_FORWARDED_PORT') : null;
if (empty($port) === true) {
$port = static::get('SERVER_PORT');
// based on forwarded port
if ($forwarded === true) {
if ($port = static::get('HTTP_X_FORWARDED_PORT')) {
return $port;
}
}
return $port;
// based on HTTP host
$host = static::get('HTTP_HOST');
if ($pos = strpos($host, ':')) {
return (int)substr($host, $pos + 1);
}
// based on server port
return static::get('SERVER_PORT');
}
/**