Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51486 invoked by uid 1010); 5 Feb 2008 22:19:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51471 invoked from network); 5 Feb 2008 22:19:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2008 22:19:21 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:2306] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/9C-14268-8E0E8A74 for ; Tue, 05 Feb 2008 17:19:21 -0500 Received: (qmail 7877 invoked by uid 98); 5 Feb 2008 22:19:30 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.01 (clamdscan: 0.88.7/5692. Clear:RC:1(127.0.0.1):. Processed in 0.102479 secs); 05 Feb 2008 22:19:30 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 5 Feb 2008 22:19:30 -0000 Received: from 98.193.37.55 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Tue, 5 Feb 2008 16:19:30 -0600 (CST) Message-ID: <48527.98.193.37.55.1202249970.squirrel@www.l-i-e.com> In-Reply-To: <47A66FBF.1040004@zend.com> References: <479A60BA.7030905@zend.com> <47A66FBF.1040004@zend.com> Date: Tue, 5 Feb 2008 16:19:30 -0600 (CST) To: "Stanislav Malyshev" Cc: "Derick Rethans" , "'PHP Internals'" Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] json_encode() bug From: ceo@l-i-e.com ("Richard Lynch") On Sun, February 3, 2008 7:51 pm, Stanislav Malyshev wrote: >> Like I mentioned before (I think), it should not return an empty >> string >> of course because programmatically it's not possible to check for >> this. >> As most of our functions return false in those cases, so should this >> function. > > AFAIR false is not valid JSON, so it would break a lot of code. Also, > I > am not sure we should change json_encode to return false on whole > structure if one of the fields contains invalid utf-8. I see what you are saying, but... If you want to write good quality code, you have to do something reasonable here. PERHAPS: Return false E_WARNING Put partially decoded value somewhere in a variable to be accessed, so that the programmer can make an informed decision about what to do. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So?