Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

RequestBodyParser does not support scalar JSON values (bool, int, float, string)

Open
#41 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
php
Domain
api

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

status:ready for adoption type:bug
What steps will reproduce the problem?
  1. Use the Yiisoft\Request\Body\Parser\JsonParser to parse a JSON body containing scalar values such as true, 42, 3.14, or "hello".
  2. 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
Dominant language
PHP
Stars
18
Forks
9
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yiisoft/request-body-parser

All issues in yiisoft/request-body-parser

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.