The input()->all method will now set every key specified in the filter. If the key doesn't exist it will be set to null.

This commit is contained in:
Alex Blackham
2019-06-21 10:44:31 +01:00
parent 153f8630f2
commit 572ba1695b

View File

@@ -303,13 +303,22 @@ class InputHandler
// Append any PHP-input json
if (strpos(trim($contents), '{') === 0) {
$post = json_decode($contents, true);
if ($post !== false) {
$output += $post;
}
}
}
return (\count($filter) > 0) ? array_intersect_key($output, array_flip($filter)) : $output;
$output = (\count($filter) > 0) ? array_intersect_key($output, array_flip($filter)) : $output;
foreach ($filter as $value) {
if (!array_key_exists($value, $output)) {
$output[$value] = null;
}
}
return $output;
}
/**