RequestBodyParser does not support scalar JSON values (bool, int, float, string)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
Research direction
Start with the Yiisoft\Request\Body\Parser\JsonParser entry point and inspect how it currently handles JSON objects and arrays. Verify behavior for true, 42, 3.14, -1e3, and "hello"; done means each scalar value is returned correctly without errors.
Written by the indexing model from the issue text.
Description
What steps will reproduce the problem?
- Use the
Yiisoft\Request\Body\Parser\JsonParserto parse a JSON body containing scalar values such astrue,42,3.14, or"hello". - Observe that the
Yiisoft\Request\Body\Parser\JsonParserdoes 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 |
- Dominant language
- PHP
- Stars
- 18
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yiisoft/request-body-parser
-
Kill mutantsOpengood first issue status:ready for adoption type:test
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in yiisoft/request-body-parser
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
backdrop-contrib/commerce#60 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
TYPO3-Documentation/TYPO3CMS-Reference-CoreApi#7330 ·
Maintainers usually reply within 1 day
-
dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100