Skip to content

Commit 7e04e46

Browse files
Merge pull request #13 from PHPFastCGI/bugfix-http-request
Bugfix: Possible null return values from getQuery() and getPost()
2 parents 57f337a + 3fe954b commit 7e04e46

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Http/Request.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,21 @@ public function getParams()
5353
*/
5454
public function getQuery()
5555
{
56-
$query = [];
56+
$query = null;
5757

5858
if (isset($this->params['QUERY_STRING'])) {
5959
parse_str($this->params['QUERY_STRING'], $query);
6060
}
6161

62-
return $query;
62+
return $query ?: [];
6363
}
6464

6565
/**
6666
* {@inheritdoc}
6767
*/
6868
public function getPost()
6969
{
70-
$post = [];
70+
$post = null;
7171

7272
if (isset($this->params['REQUEST_METHOD']) && isset($this->params['CONTENT_TYPE'])) {
7373
$requestMethod = $this->params['REQUEST_METHOD'];
@@ -81,7 +81,7 @@ public function getPost()
8181
}
8282
}
8383

84-
return $post;
84+
return $post ?: [];
8585
}
8686

8787
/**

0 commit comments

Comments
 (0)