note 87596 deleted from function.json-decode by danbrown
| From: | danbrown@php.net | Date: | Fri, 12 Dec 2008 16:22:35 +0000 |
| Subject: | note 87596 deleted from function.json-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148078@lists.php.net to get a copy of this message | ||
Note Submitter: kevin at metalaxe dot com
----
@giunta dot gaetano at sea-aeroportimilano dot it
The spec states, in entirety, that:
"
A JSON text is a sequence of tokens. The set of tokens includes six
structural characters, strings, numbers, and three literal names.
A JSON text is a serialized object or array.
"
This implies dual definition. It is BOTH. The php version of json_decode does fully implement the
json spec in this regard. HOWEVER, there is a problem with the value returned when the input is
'null' (ex. json_decode('null') ). Because the return value on failure is also
NULL, this makes the json_decode function unreliable in the case of JSON null being supplied. You
might not be in control of the API returning the value, and perhaps there is a bug in it that causes
this "error", so this is quite a problem.
RE: steven at acko dot net
The bug you mentioned has been patched, in that inconsistencies are properly handled, but the
problem I mention above will probably still exist after the next version release, so becareful
people.
I asked for the function to throw excpetion or (at least) warning. We'll see where that goes.
Some kind of NON value must be used in order to reliably use this function.