Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35070 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40186 invoked by uid 1010); 1 Feb 2008 20:15:14 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40171 invoked from network); 1 Feb 2008 20:15:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2008 20:15:13 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:53720] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/7D-31091-0DD73A74 for ; Fri, 01 Feb 2008 15:15:13 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 1 Feb 2008 22:15:10 +0200 Received: from [192.168.17.41] ([192.168.17.41]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 1 Feb 2008 12:06:51 -0800 Message-ID: <47A37BD9.2030804@zend.com> Date: Fri, 01 Feb 2008 12:06:49 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Pierre Joye CC: Cristian Rodriguez , php-dev References: <479A60BA.7030905@zend.com> <7d5a202f0802011113x3d141a9fqc577f051b35e6d6b@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Feb 2008 20:06:51.0561 (UTC) FILETIME=[FBEC5990:01C8650D] Subject: Re: [PHP-DEV] json_encode() bug From: stas@zend.com (Stanislav Malyshev) > 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@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com