Re: json_encode() / json_decode() warnings

From: Date: Fri, 28 Jul 2017 13:30:59 +0000
Subject: Re: json_encode() / json_decode() warnings
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-100081@lists.php.net to get a copy of this message
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/

« previous php.internals (#100081) next »