Fix issue for PHP 5.4.8 where the host part from parse_url seems to also include the port as well.
This commit is contained in:
parent
dc7230cbb4
commit
bebf65bfed
@ -174,8 +174,16 @@ class OAuthRequest
|
|||||||
$parts = parse_url($this->http_url);
|
$parts = parse_url($this->http_url);
|
||||||
|
|
||||||
$scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
|
$scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
|
||||||
$port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80');
|
$port = (isset($parts['port'])) ? $parts['port'] : '';
|
||||||
$host = (isset($parts['host'])) ? $parts['host'] : '';
|
if (isset($parts['host'])) {
|
||||||
|
// parse_url in PHP 5.4.8 includes the port in the host, so we need to strip it.
|
||||||
|
$host_and_maybe_port = explode(':', $parts['host']);
|
||||||
|
$host = $host_and_maybe_port[0];
|
||||||
|
} else {
|
||||||
|
$host = '';
|
||||||
|
}
|
||||||
|
// For PHP 5.4+, use:
|
||||||
|
// $host = (isset($parts['host'])) ? explode(':', $parts['host'])[0] : '';
|
||||||
$path = (isset($parts['path'])) ? $parts['path'] : '';
|
$path = (isset($parts['path'])) ? $parts['path'] : '';
|
||||||
|
|
||||||
if (($scheme == 'https' && $port != '443')
|
if (($scheme == 'https' && $port != '443')
|
||||||
|
Loading…
Reference in New Issue
Block a user