ZF-8617: Zend_Json_Decoder erroneously returns an empty array on some invalid JSON strings
Description
There are two invalid JSON cases where the native PHP JSON implementation (i.e. used when ext/json is not available or the user selects by choice) of a decoder returns an empty array. Both follow below:
Reproduce:
var_dump(Zend_Json_Decoder::decode(' {'));
var_dump(Zend_Json_Decoder::decode(' ['));
Expected:
NULL NULL
Actual:
array(0) {} array(0) {}
The given strings are invalid JSON and should not give rise to any construct that may be construed as a successful decoding. Either it should throw an Exception or return NULL in line with the behaviour of ext/json.
Comments
No comments to display