diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 302ac48..2b450ed 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,25 +4,24 @@ To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> - - - - - - ./src - - - - - - ./tests/ - - - + convertDeprecationsToExceptions="true" + stopOnFailure="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> + + + ./src + + + + + ./tests/ + + diff --git a/src/Uri.php b/src/Uri.php index 00d191b..406f20d 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -122,7 +122,7 @@ protected function setQuery($query) public function getQuery() { - return http_build_query($this->query, null, "&", PHP_QUERY_RFC3986); + return http_build_query($this->query, "", "&", PHP_QUERY_RFC3986); } /** @@ -149,13 +149,13 @@ public function getQueryPart($key) return $this->getFromArray($this->query, $key); } - private function getFromArray($array, $key) + private function getFromArray($array, $key, $default = null) { if (isset($array[$key])) { return $array[$key]; } - return null; + return $default; } private $fragment; @@ -238,7 +238,7 @@ public function __construct($uri = null) $this->username = $user; $this->password = rawurldecode($this->getFromArray($parsed, 'pass')); $this->path = preg_replace('~^//~', '', $this->getFromArray($parsed, 'path')); - $this->setQuery($this->getFromArray($parsed, 'query')); + $this->setQuery($this->getFromArray($parsed, 'query', "")); $this->fragment = $this->getFromArray($parsed, 'fragment'); }