Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 814d06b

Browse files
committed
Deal with mixed response type of json_decode
1 parent b1411f0 commit 814d06b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/JsonRequestTransformerListener.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ private function transformJsonBody(Request $request): bool
5151
{
5252
$data = json_decode((string) $request->getContent(), true);
5353

54-
if (JSON_ERROR_NONE !== json_last_error() || !is_array($data)) {
54+
if (JSON_ERROR_NONE !== json_last_error()) {
55+
return false;
56+
}
57+
58+
if (is_null($data) || is_bool($data)) {
59+
return true;
60+
}
61+
62+
if (!is_array($data)) {
5563
return false;
5664
}
5765

0 commit comments

Comments
 (0)