Re: json_encode() / json_decode() warnings
| From: | Andrea Faulds | Date: | Sat, 29 Jul 2017 15:53:18 +0000 |
| Subject: | Re: json_encode() / json_decode() warnings | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100105@lists.php.net to get a copy of this message | ||
Hi everyone,
Andrea Faulds wrote:
Craig Duncan wrote:I wrote a patch to add this flag: https://github.com/php/php-src/pull/2662 -- Andrea Faulds https://ajf.me/On 27 July 2017 at 16:57, Niklas Keller <me@kelunik.com> wrote:Could we not simply make it a flag? e.g.It should rather just throw exceptions. Warnings do not really allow error handling, they just allow error reporting.Agreed, but I can't see Exceptions passing the vote. Warnings can be silenced by those that don't care and converted to Exceptions by those that do$bar = json_encode($foo, JSON_THROW_EXCEPTIONS); $baz = json_decode($bar, false, 512, JSON_THROW_EXCEPTIONS);That wouldn't break backwards-compatibility, but would still provide the desired functionality. :)