Re: json_encode()

From: Date: Mon, 15 Dec 2008 20:53:09 +0000
Subject: Re: json_encode()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-42269@lists.php.net to get a copy of this message
Jared Williams wrote: > Don't think that's what he said... More like... > > assert(is_object($foo) || is_array($foo)); // ensure strictly conforming > $json = json_encode($foo); Which is, for all intents and purposes, the same thing. (Since you can't pass json_encode(34) for strict JSON). PHP has always erred on the side of "Just do it", and punting the "Do the right thing" to the consumer. Maybe passing an E_STRICT error would be the right combo of 1 and 2? Cheers, Edward

« previous php.internals (#42269) next »