Merge pull request #339 from skipperbent/v3-development

Version 3.4.9.1
This commit is contained in:
Simon Sessingø
2017-12-16 12:53:56 +01:00
committed by GitHub
+5 -5
View File
@@ -254,21 +254,21 @@ class Input
*/ */
public function all(array $filter = null) public function all(array $filter = null)
{ {
$output = $_POST; $output = $_GET;
if ($this->request->getMethod() === 'post') { if ($this->request->getMethod() === 'post') {
$contents = file_get_contents('php://input'); $contents = file_get_contents('php://input');
if (strpos(trim($contents), '{') === 0) { if (strpos(trim($contents), '{') === 0) {
$output = json_decode($contents, true); $post = json_decode($contents, true);
if ($output === false) { if ($post !== false) {
$output = []; $output = array_merge($output, $post);
} }
} }
} }
return ($filter !== null) ? array_intersect_key($output, array_flip($filter)) : array_merge($_GET, $output); return ($filter !== null) ? array_intersect_key($output, array_flip($filter)) : $output;
} }
} }