diff --git a/AbstractBrowser.php b/AbstractBrowser.php index 60f2fcb1..f8c89871 100644 --- a/AbstractBrowser.php +++ b/AbstractBrowser.php @@ -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()) { @@ -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); @@ -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); } } } @@ -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? @@ -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); @@ -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']); @@ -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; } diff --git a/HttpBrowser.php b/HttpBrowser.php index ed6c1002..6f5749c2 100644 --- a/HttpBrowser.php +++ b/HttpBrowser.php @@ -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