Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100072 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51763 invoked from network); 28 Jul 2017 11:07:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2017 11:07:40 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.178 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.223.178 mail-io0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:33362] helo=mail-io0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/91-40376-AFA1B795 for ; Fri, 28 Jul 2017 07:07:38 -0400 Received: by mail-io0-f178.google.com with SMTP id j32so68110358iod.0 for ; Fri, 28 Jul 2017 04:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XZr85+5s0BR8UbhM+ZKc9UY1v2Ovw64Wuw64/I+FO1E=; b=nV5YEZKqMXNmBnPvKvUQ0ncVqCECnci1raCWt2H14qQOnkM+D0p/KLWuPwnK+fSOSa qHVAknCb5ZM6cOfpyXwZr539FS0ttVtTzFRDud8BUPs1T5nzRT0qQCmF3VP86DDj3noP 011Fo/glEZJtdiek7sPKon8ULuoq+Zbx4v9CWbyCw7/qYW0mcNS0XcxoQjheaugs6m8Y z393XoNlABLLWhfWLhXrhiEbX/kCQFMgCNb5hmSEfEmODOdEtqY3bZS5VM/7HRx8BjYC mxTUzFMpbE4SrSXsQM8nGpF/TESzTfxPcBSoDf83vPARcY3FKfB675mQYWA1NdFQFRZt 5iFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XZr85+5s0BR8UbhM+ZKc9UY1v2Ovw64Wuw64/I+FO1E=; b=gNAplUhNtOpTRAjiX4fB4lx6i5cG/ImknscH1dG0yYiydujy/WXDHKyJZ6JzKgULkp Xa+WYkOobYJKkct7UoSW5KTN/g50ZLUaHuK1gc2ifqs6qXdn2BfD9GiNnIBbdoI7yjIT 0XqhTH0SJ3OmwhNdMAWjzg70hSLVxzB6PvrYyi7/wp2/Ezn+bFJyVDzCQxDcBvcuTC5q vDA7JBNq/ldcKzBt+iIENJGilluy12EcyCPyqvY4gRVboqDA6Fm68KBjYQ2Mm4EDYRY3 71jyDAPHN6juFL3wOm9/IvwOOhZl6DvpMYpCL3L276Ugt+ncGuiX3Swr7ZT/nvXfkKFE uqcw== X-Gm-Message-State: AIVw113EcOaT4XYzf+I3po3IYqHzPkKU1vlnVa/oWUW2RSUiYHK4lb8n UwKqcSogLh5gC0MuWftoY6cg0B2Rtw== X-Received: by 10.107.9.170 with SMTP id 42mr8440086ioj.211.1501240055771; Fri, 28 Jul 2017 04:07:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.33.4 with HTTP; Fri, 28 Jul 2017 04:07:35 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Jul 2017 13:07:35 +0200 Message-ID: To: Craig Duncan Cc: Internals Content-Type: multipart/alternative; boundary="001a113ebbf23f394e05555eb0ac" Subject: Re: [PHP-DEV] [RFC] Raise warnings for json_encode() and json_decode() issues From: nikita.ppv@gmail.com (Nikita Popov) --001a113ebbf23f394e05555eb0ac Content-Type: text/plain; charset="UTF-8" On Fri, Jul 28, 2017 at 12:59 PM, 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 > > Thanks, > Craig > Operations that are expected to fail should never generate warnings. We should not design functions such that their correct use requires the use of the error suppression operator. I certainly agree that the current situation is not good and that the json functions really ought to be throwing exceptions, but adding a warning now is only going to make this worse. Nikita --001a113ebbf23f394e05555eb0ac--