Hi everyone,

Andrea Faulds wrote:
Craig Duncan wrote:
On 27 July 2017 at 16:57, Niklas Keller <m...@kelunik.com> wrote:

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


Could we not simply make it a flag? e.g.

    $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. :)


I wrote a patch to add this flag: https://github.com/php/php-src/pull/2662

--
Andrea Faulds
https://ajf.me/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to