Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56377 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72294 invoked from network); 17 Nov 2011 22:23:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2011 22:23:16 -0000 Authentication-Results: pb1.pair.com header.from=patrick.allaert@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:58042] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/D7-30628-25985CE4 for ; Thu, 17 Nov 2011 17:23:15 -0500 Received: by bkbzt4 with SMTP id zt4so2811055bkb.29 for ; Thu, 17 Nov 2011 14:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pTWCzbMFTxxiBpGd5D5vyEmnidfjnq+QPj7G/aN20sc=; b=dsoPXL2KaTcD9M5LcIaDwEdKqCCPUyavYJrrSnVQ+F3V/PpeBMgEKT5WMOhupK87sl 8imrbswUeabdL1JZvztMDwo//qkEae4l7kMnzySi+10lA9oXGTRLGN24LRwp32zF5uhs tMkopOZvu2VaksECZI6zdoZHEbWgvp8yc3+qs= MIME-Version: 1.0 Received: by 10.204.154.89 with SMTP id n25mr442954bkw.75.1321568590660; Thu, 17 Nov 2011 14:23:10 -0800 (PST) Sender: patrick.allaert@gmail.com Received: by 10.223.95.205 with HTTP; Thu, 17 Nov 2011 14:23:10 -0800 (PST) In-Reply-To: <4EC581A2.5010707@php.net> References: <4EC57857.6030904@sugarcrm.com> <4EC581A2.5010707@php.net> Date: Thu, 17 Nov 2011 23:23:10 +0100 X-Google-Sender-Auth: E3G-RKOgjt5_RgC7m4BCHh3eYL8 Message-ID: To: Rasmus Lerdorf Cc: "Matthew Weier O'Phinney" , Stas Malyshev , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Results of testing ZF against PHP 5.4.0RC1 From: patrickallaert@php.net (Patrick ALLAERT) 2011/11/17 Rasmus Lerdorf : > On 11/17/2011 03:10 PM, Stas Malyshev wrote: >> Hi! >> >>> =C2=A0 =C2=A0 I recall from earlier discussions that Stas was in favor = of reverting >>> =C2=A0 =C2=A0 this change -- what's the status at this time? This singl= e change >> >> I was not and still am not - I think if something warrants notice this >> is exactly the case. Conversion of array to string "Array" IMHO makes no >> sense and not useful in any case, so if you code does that it's most >> probably a bug. I understand that some tests were written without >> accounting for this, but frankly in this case I think the right way >> would be to fix the tests. This is not the feature your code should rely >> on (and I think it should have never existed in PHP in the first place) >> and if we shall guarantee compatibility with every bug and bad decision >> we took in the past we won't be able to advance anywhere. I think in >> this case the inconvenience from fixing the tests is outweighed by the >> advantage of promoting better code and exposing hard-to-find bugs. > > I completely agree. If you are seeing a lot of these in unit tests, then > your tests are likely not testing what you think they are. > > I am seeing complaints about this notice in tests that do this: > > =C2=A0array_diff($a, $b) > > Where either $a or $b contains nested arrays. The thing with this is > that this really is not doing what you think it is when you feed it > nested arrays. =C2=A0For example: > > $a =3D [1,2,[3]]; > $b =3D [1,2,[4]]; > > This ends up comparing [1,2,'Array'] against [1,2,'Array'] and these two > arrays are thus identical as far as array_diff() is concerned. Or even > worse: > > $a =3D [1,2,'Array']; > $b =3D [1,2,[4,5,6,7,8,9]]; > > Again, array_diff() is going to tell you that there is no difference > between $a and $b. This seems like an obvious case where we issue a > NOTICE telling the user that the code probably didn't do what they > wanted it to. > > -Rasmus Stas and Rasmus summarized my point of view very well when I proposed that patch. Note that this change should have be a one liner, but it turns out to be a much bigger work [1] because of internal tests also relying on this conversion not to complain. [1] http://svn.php.net/viewvc?view=3Drevision&revision=3D318288 --=20 Patrick