Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Enable "native_constant_invocation" CS rule
  Make AbstractPhpFileCacheWarmer public
  • Loading branch information
nicolas-grekas committed Sep 2, 2020
2 parents b9545e0 + 4012fac commit 7abd647
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions AbstractBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ public function request(string $method, string $uri, array $parameters = [], arr

$server = array_merge($this->server, $server);

if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, PHP_URL_HOST)) {
if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, \PHP_URL_HOST)) {
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
}

if (isset($server['HTTPS']) && null === parse_url($originalUri, PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
if (isset($server['HTTPS']) && null === parse_url($originalUri, \PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, \PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
}

if (!isset($server['HTTP_REFERER']) && !$this->history->isEmpty()) {
Expand All @@ -368,7 +368,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
$server['HTTP_HOST'] = $this->extractHost($uri);
}

$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
$server['HTTPS'] = 'https' == parse_url($uri, \PHP_URL_SCHEME);

$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);

Expand Down Expand Up @@ -437,9 +437,9 @@ protected function doRequestInProcess($request)
foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
if ($deprecation[0]) {
// unsilenced on purpose
trigger_error($deprecation[1], E_USER_DEPRECATED);
trigger_error($deprecation[1], \E_USER_DEPRECATED);
} else {
@trigger_error($deprecation[1], E_USER_DEPRECATED);
@trigger_error($deprecation[1], \E_USER_DEPRECATED);
}
}
}
Expand Down Expand Up @@ -653,7 +653,7 @@ protected function getAbsoluteUri(string $uri)

// protocol relative URL
if (0 === strpos($uri, '//')) {
return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri;
return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri;
}

// anchor or query string parameters?
Expand All @@ -662,7 +662,7 @@ protected function getAbsoluteUri(string $uri)
}

if ('/' !== $uri[0]) {
$path = parse_url($currentUri, PHP_URL_PATH);
$path = parse_url($currentUri, \PHP_URL_PATH);

if ('/' !== substr($path, -1)) {
$path = substr($path, 0, strrpos($path, '/') + 1);
Expand All @@ -689,7 +689,7 @@ protected function requestFromRequest(Request $request, $changeHistory = true)
private function updateServerFromUri(array $server, string $uri): array
{
$server['HTTP_HOST'] = $this->extractHost($uri);
$scheme = parse_url($uri, PHP_URL_SCHEME);
$scheme = parse_url($uri, \PHP_URL_SCHEME);
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);

Expand All @@ -698,9 +698,9 @@ private function updateServerFromUri(array $server, string $uri): array

private function extractHost(string $uri): ?string
{
$host = parse_url($uri, PHP_URL_HOST);
$host = parse_url($uri, \PHP_URL_HOST);

if ($port = parse_url($uri, PHP_URL_PORT)) {
if ($port = parse_url($uri, \PHP_URL_PORT)) {
return $host.':'.$port;
}

Expand Down
2 changes: 1 addition & 1 deletion HttpBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private function getBodyAndExtraHeaders(Request $request, array $headers): array
return ['', []];
}

return [http_build_query($fields, '', '&', PHP_QUERY_RFC1738), ['Content-Type' => 'application/x-www-form-urlencoded']];
return [http_build_query($fields, '', '&', \PHP_QUERY_RFC1738), ['Content-Type' => 'application/x-www-form-urlencoded']];
}

private function getHeaders(Request $request): array
Expand Down

0 comments on commit 7abd647

Please sign in to comment.