From 357c7233778f9ac5a2af7b55aa90077ac87d25de Mon Sep 17 00:00:00 2001 From: Elized Date: Thu, 6 Aug 2026 00:46:10 +0300 Subject: [PATCH] Fix parsing of invalid JSON request bodies --- src/Pecee/Http/Input/InputHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Pecee/Http/Input/InputHandler.php b/src/Pecee/Http/Input/InputHandler.php index 79bd672..30527d6 100644 --- a/src/Pecee/Http/Input/InputHandler.php +++ b/src/Pecee/Http/Input/InputHandler.php @@ -79,8 +79,8 @@ public function parseInputs(): void if (strpos(trim($contents), '{') === 0) { $post = json_decode($contents, true); - if ($post !== false) { - $this->originalPost += $post; + if (json_last_error() === JSON_ERROR_NONE) { + $this->originalPost += is_array($post) ? $post : [$post]; } } else { $post = [];