Stanislav Malyshev | 1 Feb 2008 21:06
Favicon

Re: [PHP-DEV] json_encode() bug

> Stupid question, who actually checks for E_* in his code at runtime
> after having called such functions? Not me and I would hate to. It
> sounds to me like a perfect exception use case. As this function can

General policy in PHP as far as I know is that non-OO functions do not 
do exceptions.

> return nearly everything scalar we have (boolean, string, null,
> integer,...) we can't use our normal "returns FALSE on failure".

This function can return only a string, but I'm not sure returning false 
if somewhere in some value deep down your data is some bad utf-8 is 
warranted. It is doable, though, but I'm afraid most of current code 
never check for return of json_encode() so they are in for big surprises 
  when json_encode won't produce valid JSON.
-- 
Stanislav Malyshev, Zend Software Architect
stas <at> zend.com   http://www.zend.com/
(408)253-8829   MSN: stas <at> zend.com

--

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Gmane