Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56375 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66984 invoked from network); 17 Nov 2011 21:50:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2011 21:50:32 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.213.42 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:55681] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/D6-30628-7A185CE4 for ; Thu, 17 Nov 2011 16:50:32 -0500 Received: by ywm19 with SMTP id 19so1923995ywm.29 for ; Thu, 17 Nov 2011 13:50:29 -0800 (PST) Received: by 10.101.93.18 with SMTP id v18mr111137anl.58.1321566629009; Thu, 17 Nov 2011 13:50:29 -0800 (PST) Received: from [192.168.5.184] ([209.117.217.2]) by mx.google.com with ESMTPS id l27sm99614977ani.21.2011.11.17.13.50.27 (version=SSLv3 cipher=OTHER); Thu, 17 Nov 2011 13:50:27 -0800 (PST) Sender: Rasmus Lerdorf Message-ID: <4EC581A2.5010707@php.net> Date: Thu, 17 Nov 2011 15:50:26 -0600 Organization: PHP Development Team User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Matthew Weier O'Phinney CC: Stas Malyshev , "internals@lists.php.net" References: <4EC57857.6030904@sugarcrm.com> In-Reply-To: <4EC57857.6030904@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Results of testing ZF against PHP 5.4.0RC1 From: rasmus@php.net (Rasmus Lerdorf) On 11/17/2011 03:10 PM, Stas Malyshev wrote: > Hi! > >> I recall from earlier discussions that Stas was in favor of reverting >> this change -- what's the status at this time? This single 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: array_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. For example: $a = [1,2,[3]]; $b = [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 = [1,2,'Array']; $b = [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