: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$decodedKeys = \array_map(function ($k) : string {
return \rawurldecode((string) $k);
return \array_filter(\explode('&', $current), function ($part) use($decodedKeys) {
return !\in_array(\rawurldecode(\explode('=', $part)[0]), $decodedKeys, \true);
private static function generateQueryString(string $key, ?string $value) : string
// Query string separators ("=", "&") within the key or value need to be encoded
// (while preventing double-encoding) before setting the query string. All other
// chars that need percent-encoding will be encoded by withQuery().
$queryString = \strtr($key, self::QUERY_SEPARATORS_REPLACEMENT);
$queryString .= '=' . \strtr($value, self::QUERY_SEPARATORS_REPLACEMENT);
private function removeDefaultPort() : void
if ($this->port !== null && self::isDefaultPort($this)) {
* Filters the path of a URI
* @throws \InvalidArgumentException If the path is invalid.
private function filterPath($path) : string
if (!\is_string($path)) {
throw new \InvalidArgumentException('Path must be a string');
return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\\/]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path);
* Filters the query string or fragment of a URI.
* @throws \InvalidArgumentException If the query or fragment is invalid.
private function filterQueryAndFragment($str) : string
throw new \InvalidArgumentException('Query and fragment must be a string');
return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\\/\\?]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str);
private function rawurlencodeMatchZero(array $match) : string
return \rawurlencode($match[0]);
private function validateState() : void
if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
$this->host = self::HTTP_DEFAULT_HOST;
if ($this->getAuthority() === '') {
if (0 === \strpos($this->path, '//')) {
throw new \YoastSEO_Vendor\GuzzleHttp\Psr7\Exception\MalformedUriException('The path of a URI without an authority must not start with two slashes "//"');
if ($this->scheme === '' && \false !== \strpos(\explode('/', $this->path, 2)[0], ':')) {
throw new \YoastSEO_Vendor\GuzzleHttp\Psr7\Exception\MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon');