Upgrade to 3.6.0
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user