Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Zend\Json\Json::decode null or empty string throw Zend\Json\Exception\RuntimeException on PHP7 #23

Open
yuripave opened this issue Apr 14, 2016 · 4 comments

Comments

@yuripave
Copy link

Similar to zendframework/zf1#678. ZF1 fix PR on zendframework/zf1#680.

@marc-mabe
Copy link
Member

As already told in zendframework/zend-cache#95

@yuripave
Copy link
Author

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

@v-noskov
Copy link

v-noskov commented Apr 16, 2016

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.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-json; a new issue has been opened at laminas/laminas-json#6.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants