php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49133 json_decode - return value on failure
Submitted: 2009-08-02 05:09 UTC Modified: 2009-08-03 12:16 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: php at jasonstark dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at jasonstark dot com
New email:
PHP Version: OS:

 

 [2009-08-02 05:09 UTC] php at jasonstark dot com
Description:
------------
The documentation for json_decode function doesn't explicitly state what happens or what the return value is when an invalid json string is passed in. 

Reproduce code:
---------------
---
From manual page: function.json-decode
---


Expected result:
----------------
Could you add a statement to the documentation for json_decode - Return Values: "Returns NULL when string cannot be parsed"?  Thanks!

Actual result:
--------------
It doesn't say what happens.  Example #3 alludes to the fact but it would be very helpful if it were included in the description above.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-03 12:15 UTC] svn@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=286730
Log: Return type will be null, not false, when an error occurs. Use json_last_error() to determine exact cause. Bug#49133.
 [2009-08-03 12:16 UTC] rquadling@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 21:00:02 2026 UTC