JSON_ERROR_DEPTH with JSON_PARTIAL_OUTPUT_ON_ERROR.
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Hi, json_encode, when it exceeds the max depth, having the flag JSON_PARTIAL_OUTPUT_ON_ERROR, just ignores the max depth and goes on. Shouldn't be a better choice to stop at that depth, replacing by null, for example, following the "partial output" sense as with JSON_ERROR_RECURSION?
Ignoring the optional depth limit seems a bug and truncating the chain of references with null, giving a partial output seems natural.
It seems a trivial change in the sources, thank you.
Contributor 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.
Research direction
Start by reproducing json_encode with JSON_PARTIAL_OUTPUT_ON_ERROR on data exceeding the configured depth, then trace the JSON encoding implementation in the PHP source. Done means the depth limit is respected and the output is partial, such as replacing the over-depth value with null, with regression coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100