Skip to content

Commit 9c7035e

Browse files
committed
more fixes
1 parent 9e989ad commit 9c7035e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Url.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function hasQueryParameter($name)
324324
*/
325325
public function getQueryParameters()
326326
{
327-
return empty($this->info['query']) ? [] : $this->info['query'];
327+
return $this->info['query'];
328328
}
329329

330330
/**
@@ -442,14 +442,16 @@ protected function parseUrl($url)
442442

443443
$this->info = parse_url($url);
444444

445-
if (isset($this->info['query'])) {
445+
if (empty($this->info['query'])) {
446+
$this->info['query'] = [];
447+
} else {
446448
$queryString = preg_replace_callback('/(^|(?<=&))[^=[&]+/', function ($key) {
447449
return base64_encode(urldecode($key[0]));
448450
}, $this->info['query']);
449451

450452
parse_str($queryString, $query);
451453

452-
$this->info['query'] = self::fixQuery($query);
454+
$this->info['query'] = $query ? self::fixQuery($query) : [];
453455
}
454456

455457
if (isset($this->info['path'])) {

0 commit comments

Comments
 (0)