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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC