php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38440 json_decode() on boolean strings returns NULL
Submitted: 2006-08-13 07:05 UTC Modified: 2006-08-13 08:47 UTC
From: clay at killersoft dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.0RC1 OS: Mac OS X 10.4.7
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: clay at killersoft dot com
New email:
PHP Version: OS:

 

 [2006-08-13 07:05 UTC] clay at killersoft dot com
Description:
------------
JSON decoder returns NULL when passed a string containing 'true'.

Reproduce code:
---------------
var_dump(json_decode('true'));

Expected result:
----------------
bool(true)

Actual result:
--------------
NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-13 07:23 UTC] clay at killersoft dot com
var_dump(json_decode('false'));

Should return:

bool(false);

Actually returns:

NULL
 [2006-08-13 08:47 UTC] clay at killersoft dot com
fail1.json of the JSON_checker test suite says:

"A JSON payload should be an object or array, not a string."

Sorry about the noise.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Feb 01 07:01:31 2025 UTC