php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75915 json_decode recursion level misleading
Submitted: 2018-02-04 23:57 UTC Modified: 2018-02-05 12:09 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: chris at candm dot org dot uk Assigned:
Status: Open Package: JSON related
PHP Version: 7.0.27 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chris at candm dot org dot uk
New email:
PHP Version: OS:

 

 [2018-02-04 23:57 UTC] chris at candm dot org dot uk
Description:
------------
The documentation suggests that json_decode will only analyse down to the recursion level specified. But it does not say that when that happens it will just give up. 

However it would be better to alter the behaviour. It would be better if it analysed down to and returned results for the analysis down to the recursion level specified. e.g.

json_decode('[3,4,{"X":"Y"}]', false, 1);
should return
array(3) [
3
4
'{"X":"Y"}'
]

This would allow analysis in sections for large objects and various other useful purposes.
rather than null;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-05 12:09 UTC] cmb@php.net
-Package: Online Doc Editor problem +Package: JSON related
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Nov 13 20:01:26 2018 UTC