|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81138 json_encode doesn't mention dtring could be returned
Submitted: 2021-06-14 16:48 UTC Modified: 2021-06-14 16:54 UTC
From: tim dot d dot whitney at gmail dot com Assigned: danack (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 7.4.20 OS:
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.
Bug Type:
From: tim dot d dot whitney at gmail dot com
New email:
PHP Version: OS:


 [2021-06-14 16:48 UTC] tim dot d dot whitney at gmail dot com
From manual page:

>>> json_decode('"{\"test\": 123}"', TRUE);
=> "{"test": 123}"

The documentation does not mention that a string could be returned.

Test script:
>>> json_decode('"{\"test\": 123}"', TRUE);
=> "{"test": 123}"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-14 16:54 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: danack
 [2021-06-14 16:54 UTC]
I don't think it needs to do that, as string is the "appropriate PHP type." sometimes.

var_dump(json_decode(json_encode('"{\"test\": 123}"'), TRUE));

If you want to propose some better wording, please do so at:
 [2021-06-14 16:54 UTC]
-Status: Closed +Status: Not a bug
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 14:03:33 2021 UTC