What steps will reproduce the problem?
- Use the
Yiisoft\Request\Body\Parser\JsonParser to parse a JSON body containing scalar values such as true, 42, 3.14, or "hello".
- Observe that the
Yiisoft\Request\Body\Parser\JsonParser does not handle these scalar values correctly.
What is the expected result?
The RequestBodyParser should correctly parse JSON bodies containing scalar values (boolean, integer, float, string) and return these values without errors.
json_decode('true'); // Expected result: true (boolean)
json_decode('42'); // Expected result: 42 (integer)
json_decode('3.14'); // Expected result: 3.14 (float)
var_dump(json_decode('-1e3')); // Expected -1000 (float)
json_decode('"hello"');// Expected result: "hello" (string)
What do you get instead?
The RequestBodyParser fails to handle JSON bodies with scalar values and does not return the expected result. Instead, it only supports objects and arrays.
| Q |
A |
| Version |
1.0.? |
| PHP version |
any |
| Operating system |
any |
What steps will reproduce the problem?
Yiisoft\Request\Body\Parser\JsonParserto parse a JSON body containing scalar values such astrue,42,3.14, or"hello".Yiisoft\Request\Body\Parser\JsonParserdoes not handle these scalar values correctly.What is the expected result?
The
RequestBodyParsershould correctly parse JSON bodies containing scalar values (boolean, integer, float, string) and return these values without errors.What do you get instead?
The
RequestBodyParserfails to handle JSON bodies with scalar values and does not return the expected result. Instead, it only supports objects and arrays.