MVC - minor bugfix in ApiControllerBase->parseJsonBodyData() when $jsonRawBody isn't of array type we should skip merging entries.

This commit is contained in:
Ad Schellevis 2022-11-20 20:05:33 +01:00
parent 47eac7dbf8
commit 6ac82416d7

View File

@ -127,7 +127,7 @@ class ApiControllerBase extends ControllerRoot
if (empty($this->request->getRawBody()) && empty($jsonRawBody)) {
return "Invalid JSON syntax";
}
$_POST = $jsonRawBody;
$_POST = is_array($jsonRawBody) ? $jsonRawBody : [];
foreach ($_POST as $key => $value) {
$_REQUEST[$key] = $value;
}