Doc #81138 [Csd->Nab]: json_encode doesn't mention dtring could be returned
| From: | danack@php.net | Date: | Mon, 14 Jun 2021 16:54:18 +0000 |
| Subject: | Doc #81138 [Csd->Nab]: json_encode doesn't mention dtring could be returned | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18856@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81138&edit=1
ID: 81138
Updated by: danack@php.net
Reported by: tim dot d dot whitney at gmail dot com
Summary: json_encode doesn't mention dtring could be returned
-Status: Closed
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.4.20
Assigned To: danack
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2021-06-14 16:54:09] danack@php.net
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:
https://github.com/php/doc-en/blob/master/reference/json/functions/json-decode.xml
------------------------------------------------------------------------
[2021-06-14 16:48:03] tim dot d dot whitney at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.json-decode
---
>>> 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}"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81138&edit=1