Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100075 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57900 invoked from network); 28 Jul 2017 11:37:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2017 11:37:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.173 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.161.173 mail-yw0-f173.google.com Received: from [209.85.161.173] ([209.85.161.173:36418] helo=mail-yw0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/D2-40376-BD12B795 for ; Fri, 28 Jul 2017 07:36:59 -0400 Received: by mail-yw0-f173.google.com with SMTP id u207so60655196ywc.3 for ; Fri, 28 Jul 2017 04:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1E7ccAiOHlIIM/jpV2k1cxw3CQjYLRSl+/ecNGklnqs=; b=hh9YY/SnPqyKvHT79smiY70NTBGAv786GukXxD3760N8UqWnVK/S0fDa3nGCxvUVbP rjliPK4D47LAwkiKjDNGWXOP5DPA/PzEOlEBPfV+4xp3SivJq4//TwuTdMW+DMB6x4av UDZnwiX2YR6c1XLf3P4LXuWX/ODgkRa5B4PDdqgCvbMH78Slg7u/m0kAe2y++pVkPxL5 N7qMfwlYw9Z0gTjAjrkoFld0GsQyE2STi7lfZe/PNZ7/GKuVBi9qnfYRKqC5E7Xb83De FfiP54cLq28PbOs+qo3V7jlZ/kxmuqH9dBqch+uEiwE3eFY7d1XVgxAA8nEbkiG/nxym LIgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1E7ccAiOHlIIM/jpV2k1cxw3CQjYLRSl+/ecNGklnqs=; b=f1O0UWY5LoDv/O9RDqPxTzfZUGrsOV6+nXOpEDZerQ6Oqpj6VwhJ4e3waE6pD7d+7k Akmg3L6Zo8c+EGNRp+LIlGZWv3uaF5SahNRL140X2wpB0ZWBZPSDZb2Y/rkpM+qRnBx3 sL4Mwp05uXLCklDpezNJfsNSJDYoN7Pu3qmN/bn8pAxjciULT/CfeRPkK63+yQ8cmeqq A4Ltp6aGOxZNE+b5w0FCBvDDo7McRYJJiUxWfVXnoBFQzEcEEUc4TUgIUyzSQ1sdbNM3 Btji3eCqN9bVwU0nwQRwimj23w2I3f2HQ6KdX00Mg7x7yhmoW9S4sRvvP01FPJwte3+E 63NA== X-Gm-Message-State: AIVw111q/rwz1F164UtcqsfsawMAsnNKsi3stiCWvSccEOtEz9iMV3/E 2JBFI/IRsmDD1Zs0T5GuOGOjsYSxdw7S X-Received: by 10.129.165.150 with SMTP id c144mr6118792ywh.19.1501241816162; Fri, 28 Jul 2017 04:36:56 -0700 (PDT) MIME-Version: 1.0 Sender: jakub.php@gmail.com Received: by 10.129.116.135 with HTTP; Fri, 28 Jul 2017 04:36:55 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Jul 2017 12:36:55 +0100 X-Google-Sender-Auth: HHfs0IOrC1iCBIAiU5FAB5I9YjM Message-ID: To: Craig Duncan Cc: Internals Content-Type: multipart/alternative; boundary="94eb2c128e3c2cadee05555f19b6" Subject: Re: [PHP-DEV] [RFC] Raise warnings for json_encode() and json_decode() issues From: bukka@php.net (Jakub Zelenka) --94eb2c128e3c2cadee05555f19b6 Content-Type: text/plain; charset="UTF-8" On Fri, Jul 28, 2017 at 11:59 AM, Craig Duncan wrote: > Hi internals. > > As my initial thread about introducing warnings to the JSON functions was > not immediately flooded with disagreement I took the liberty of creating an > RFC for official discussion. > > The proposal is to have `json_encode()` and `json_decode()` raise warnings > whenever a failure occurs, instead of requiring the developer to call > `json_last_error()` each time. > > The functionality of `json_last_error()` and `json_last_error_msg()` are > unaffected and they can still be used in exactly the same way they are > today > > https://wiki.php.net/rfc/json_encode_decode_errors > > I don't think this is a good idea. Especially in case of json_decode the invalid JSON comes from sources that user does not have any control and can't prevent the fail. Emitting warning wouldn't be helpful and it would just make it more difficult to handle such cases. Also it would break a big amount of code because in case of converting errors to exceptions, you start getting a different exception so it would have to be handled. I would call the whole proposal just a big BC break (I'm aware that we don't consider adding warnings as BC but in this case it is) for no benefit at all! Cheers Jakub --94eb2c128e3c2cadee05555f19b6--