#40608 [NoF]: break within foreach causes strange behaviour

From: Date: Sun, 20 May 2007 12:12:54 +0000
Subject: #40608 [NoF]: break within foreach causes strange behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112873@lists.php.net to get a copy of this message
ID: 40608 Updated by: cipri@php.net Reported By: eric dot broersma at phil dot uu dot nl Status: No Feedback Bug Type: Arrays related Operating System: Sun Solaris PHP Version: 5.2.1 New Comment: A quick fix that somehow forces PHP to work again, is to access the key in the second(inner) loop: echo 'a'; foreach ( $w as $x ) { echo 'b' . $x; foreach ( $w as $z ) { key($w); echo 'c' . $z; break 1; } echo 'e' . $x; } echo 'f'; Outputs: ab0c0e0b1c0e1f Previous Comments: ------------------------------------------------------------------------ [2007-04-29 22:16:47] chris at dented-planet dot net I can reproduce this with PHP-CLI 5.2.1 on Mac OS X 10.4.9 Intel. ------------------------------------------------------------------------ [2007-03-31 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-03-23 07:53:12] cweiske@php.net I cannot reproduce this on Gentoo with 5.2.1 ------------------------------------------------------------------------ [2007-03-20 16:40:30] ashnazg@php.net I wasn't feeling spunky enough to mark the bug "closed", though... figured I'd better leave that to the real PHP devs... ------------------------------------------------------------------------ [2007-03-20 16:35:58] ashnazg@php.net My bad... pretending to be a dev myself there, by selecting the "Quick Fix" option to "notify" the original bug submitter (and all readers) about the snapshot option. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40608 -- Edit this bug report at http://bugs.php.net/?id=40608&edit=1

« previous php.bugs (#112873) next »