Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread Antony Dovgal
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

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread Richard K Miller
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

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread 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

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread Richard K Miller
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

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread jeffg
On 09-10-21 07:47 PM, Marco Tabini wrote: On 2009-10-21, at 10:40 PM, Richard K Miller wrote: I don't follow. Is this really the intended behavior? It seems quite unintuitive that the original array would be modified by *empty* loops. It is intended behaviour. Consider your code; at the end

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread Rasmus Lerdorf
Richard K Miller wrote: 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

Re: [PHP-DEV] bug when using foreach with references?

2009-10-22 Thread Richard K Miller
It would be arbitrarily breaking an explicit reference. I know I have code lying around that relies on multiple loops cleaning up a big complicated multi-level array. I do ugly things with references into that array and it would completely break if PHP magically deleted my references whether