Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16481 invoked from network); 22 Oct 2009 15:34:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2009 15:34:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 74.125.92.25 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 74.125.92.25 qw-out-2122.google.com Received: from [74.125.92.25] ([74.125.92.25:31866] helo=qw-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/CA-21514-96B70EA4 for ; Thu, 22 Oct 2009 11:34:02 -0400 Received: by qw-out-2122.google.com with SMTP id 9so773100qwb.59 for ; Thu, 22 Oct 2009 08:33:59 -0700 (PDT) Received: by 10.102.177.33 with SMTP id z33mr4220273mue.87.1256225638268; Thu, 22 Oct 2009 08:33:58 -0700 (PDT) Received: from ?192.168.200.148? (c-69-181-146-64.hsd1.ca.comcast.net [69.181.146.64]) by mx.google.com with ESMTPS id j10sm140907mue.36.2009.10.22.08.33.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Oct 2009 08:33:57 -0700 (PDT) Message-ID: <4AE07B61.7030308@lerdorf.com> Date: Thu, 22 Oct 2009 08:33:53 -0700 User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Richard K Miller CC: Antony Dovgal , internals@lists.php.net References: <84898698-728C-44ED-BF7A-E0E02C111F68@gmail.com> <4AE00CE9.9050602@daylessday.org> <2FEC738F-A4EF-4853-8CC7-D4DAF97D892C@gmail.com> In-Reply-To: <2FEC738F-A4EF-4853-8CC7-D4DAF97D892C@gmail.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] bug when using foreach with references? From: rasmus@lerdorf.com (Rasmus Lerdorf) Richard K Miller wrote: > On Oct 22, 2009, at 1:42 AM, Antony Dovgal wrote: > >> On 22.10.2009 05:37, Richard K Miller wrote: >>> Is this a bug in PHP? >> >> Search the bug DB before asking such questions. >> >> http://bugs.php.net/bug.php?id=29992 >> http://bugs.php.net/bug.php?id=39307 >> http://bugs.php.net/bug.php?id=40065 >> http://bugs.php.net/bug.php?id=40654 >> http://bugs.php.net/bug.php?id=41603 >> http://bugs.php.net/bug.php?id=43501 >> http://bugs.php.net/bug.php?id=43806 >> http://bugs.php.net/bug.php?id=43988 >> http://bugs.php.net/bug.php?id=47388 >> > > Antony, > > I've seen some of those, though not all, but thought I'd bring it up for > discussion. I've appreciated the thoughtful responses, for example from > Marco Tabini, to help explain this. It still doesn't quite make sense to > me. > > Doesn't it seem alarming that there are so many bug reports on this > issue, even if from an internals perspective it makes sense to you? It is one of these things that make perfect sense when you think about it a little bit. Yes, it catches some people, just like strpos() returning character position 0 on a first-char match catches some people. There is no way to fix things like these without completely breaking things. If we had strpos not use 0-based string positions or if we arbitrarily broke references after loops, all sorts of other things would start breaking and no longer make sense. -Rasmus