1
0
mirror of https://github.com/flarum/core.git synced 2025-05-07 07:55:44 +02:00

Make sure JSON request bodies are parsed as array.

Refs #533.
This commit is contained in:
Franz Liedke 2015-09-22 15:19:54 +02:00
parent 0b0f1bc142
commit ee9862004d

View File

@ -23,6 +23,10 @@ class ReadJsonParameters implements MiddlewareInterface
{
if (str_contains($request->getHeaderLine('content-type'), 'json')) {
$input = json_decode($request->getBody(), true);
if (! is_array($input)) {
$input = [];
}
foreach ($input as $name => $value) {
$request = $request->withAttribute($name, $value);