Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100081 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69984 invoked from network); 28 Jul 2017 13:31:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2017 13:31:17 -0000 Authentication-Results: pb1.pair.com header.from=thruska@cubiclesoft.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=thruska@cubiclesoft.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cubiclesoft.com designates 149.56.142.28 as permitted sender) X-PHP-List-Original-Sender: thruska@cubiclesoft.com X-Host-Fingerprint: 149.56.142.28 28.ip-149-56-142.net Received: from [149.56.142.28] ([149.56.142.28:50292] helo=28.ip-149-56-142.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/F4-40376-A9C3B795 for ; Fri, 28 Jul 2017 09:31:07 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: thruska@cubiclesoft.com) with ESMTPSA id 6D6B33E84E To: Ryan Jentzsch , Niklas Keller Cc: Giovanni Giacobbi , Craig Duncan , Internals References: Message-ID: <99aeb89c-1db9-493f-428f-17e24f6e17d7@cubiclesoft.com> Date: Fri, 28 Jul 2017 06:30:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] json_encode() / json_decode() warnings From: thruska@cubiclesoft.com (Thomas Hruska) On 7/28/2017 3:03 AM, Ryan Jentzsch wrote: > I can't count how many times I've been bitten by this. From the infamous > fractal blog: > > "Parts of PHP are practically designed to produce buggy code. > json_decode returns null for invalid input, even though null is also a > perfectly valid object for JSON to decode to—this function is completely > unreliable unless you also call json_last_error every time you use it." > > Most functions in PHP return false as an indicator for an invalid call. > json_decode() returns null -- changing this to return false is also a > breaking change that may not survive a vote. 'false' is also valid JSON. -- Thomas Hruska CubicleSoft President I've got great, time saving software that you will find useful. http://cubiclesoft.com/ And once you find my software useful: http://cubiclesoft.com/donate/