Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100108 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61293 invoked from network); 29 Jul 2017 16:55:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jul 2017 16:55:34 -0000 X-Host-Fingerprint: 95.148.131.182 unknown Received: from [95.148.131.182] ([95.148.131.182:10156] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/AF-40376-40EBC795 for ; Sat, 29 Jul 2017 12:55:33 -0400 Message-ID: <4F.AF.40376.40EBC795@pb1.pair.com> To: internals@lists.php.net References: Date: Sat, 29 Jul 2017 17:55:29 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 95.148.131.182 Subject: Re: [PHP-DEV] json_encode() / json_decode() warnings From: ajf@ajf.me (Andrea Faulds) Hi Craig, Craig Duncan wrote: > On 29 July 2017 at 15:16, Andrea Faulds wrote: > >> 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. :) > > > Hi Andrea, although that wouldn't break compatibility, it doesn't protect > new developers from using them dangerously. > That desired functionality is available in many userland libraries, I don't > think we gain much from adding it to core. > My aim is to make the core functions easier/safer to use out of the box. That's true, but if we add it to core we can save people reimplementing it themselves or adding an extra dependency, and perhaps more pertinently, it could be the first step to making this the default behaviour. -- Andrea Faulds https://ajf.me/