JSON decoding on an empty string behaves differently with PHP 7

Result in PHP 5.6

json_decode('', true); echo last_json_error(); // 0 

Result in PHP 7.0

 json_decode('', true); echo last_json_error(); // 4 

I checked the PHP 7 change log ( https://github.com/tpunt/PHP7-Reference ) and could not find the reason for this. JSON has been replaced by JSOND, but BC's jump list doesn't mention it !?

To clarify: My question is not about valid / invalid JSON. This is about the behavior of a PHP change that I could not find.

+5
source share

Source: https://habr.com/ru/post/1242808/


All Articles