Zend\Json\Json::decode null or empty string throw Zend\Json\Exception\RuntimeException on PHP7
Similar to https://github.com/zendframework/zf1/issues/678. ZF1 fix PR on https://github.com/zendframework/zf1/pull/680.
As already told in zendframework/zend-cache#95
- It's a bug in zend-cache that will be addressed by zendframework/zend-cache#96
- In my opinion a serializer (all of
zend-serializerandzend-json) should throw an exception in case of trying to unserialize or decode invalid input
Agree as a serializer component we should throw an exception in case of trying to unserialize or decode invalid input.
Those that upgrading PHP5 to PHP7 will need to deal with json_last_error behavior change such that json_decode('') PHP5 return JSON_ERROR_NONE but PHP7 return JSON_ERROR_SYNTAX.
References: https://bugs.php.net/bug.php?id=71718 http://php.net/manual/en/function.json-last-error.php#118165 http://stackoverflow.com/questions/36362856/php7-json-and-zend-decoding-failed-syntax-error
Php changed behavior of json_last_error with major version changing. Component zend-json doesn't change major or even minor version. In my opinion, it must preserve backward compatibility and fix issue on php7. Anyway, component should have the same behaviour on all supported versions of php.
This repository has been closed and moved to laminas/laminas-json; a new issue has been opened at https://github.com/laminas/laminas-json/issues/6.