From d18471ba9591cdf7f09bd4753af435b150058363 Mon Sep 17 00:00:00 2001 From: Luciano Righetti Date: Tue, 25 Jan 2022 18:02:41 +0100 Subject: [PATCH] fix: failing when request is empty json object --- src/Controller/Component/ParamHandlerComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Component/ParamHandlerComponent.php b/src/Controller/Component/ParamHandlerComponent.php index e52e5f8..92260fd 100644 --- a/src/Controller/Component/ParamHandlerComponent.php +++ b/src/Controller/Component/ParamHandlerComponent.php @@ -48,7 +48,7 @@ class ParamHandlerComponent extends Component return $this->isRest; } if ($this->request->is('json')) { - if (!empty((string)$this->request->getBody()) && empty($this->request->getParsedBody())) { + if (!empty((string)$this->request->getBody()) && !is_array($this->request->getParsedBody())) { throw new MethodNotAllowedException('Invalid JSON input. Make sure that the JSON input is a correctly formatted JSON string. This request has been blocked to avoid an unfiltered request.'); } $this->isRest = true;