Skip to content

Commit

Permalink
Merge pull request #13 from PHPFastCGI/bugfix-http-request
Browse files Browse the repository at this point in the history
Bugfix: Possible null return values from getQuery() and getPost()
  • Loading branch information
AndrewCarterUK committed Aug 26, 2015
2 parents 57f337a + 3fe954b commit 7e04e46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ public function getParams()
*/
public function getQuery()
{
$query = [];
$query = null;

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

return $query;
return $query ?: [];
}

/**
* {@inheritdoc}
*/
public function getPost()
{
$post = [];
$post = null;

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

return $post;
return $post ?: [];
}

/**
Expand Down

0 comments on commit 7e04e46

Please sign in to comment.