json_encode() / json_decode() warnings

From: Date: Thu, 27 Jul 2017 15:41:22 +0000
Subject: json_encode() / json_decode() warnings
Groups: php.internals 
Request: Send a blank email to internals+get-100061@lists.php.net to get a copy of this message
Hi internals, When using json_encode() and json_decode() it is required that you manually check for errors after every call, eg: ```php $data = json_decode("false"); if (json_last_error() !== JSON_ERROR_NONE) { throw new UnexpectedValueException(json_last_error_msg()); } ``` This isn't _that_ unusual in PHP, however normally in these situations a warning would be raised. But the JSON functions only raise warnings in a couple of scenarios, most issues are completely silent. I wanted to begin a discussion around changing this, so that warnings are raised for any issues during json_encode() and json_decode(). I have an implementation ready and I'm happy to draft an RFC if this suggestion doesn't receive universal hatred. Thanks for your time, Craig

« previous php.internals (#100061) next »