#24222 [Opn->Csd]: crash: setting parent reference to child, then do for/count empty loop

From: Date: Tue, 17 Jun 2003 16:20:11 +0000
Subject: #24222 [Opn->Csd]: crash: setting parent reference to child, then do for/count empty loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42141@lists.php.net to get a copy of this message
ID: 24222 Updated by: sniper@php.net Reported By: xuefer at 21cn dot com -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: win32 PHP Version: 4.3.2 New Comment: Latest CVS does not crash. Previous Comments: ------------------------------------------------------------------------ [2003-06-17 07:20:07] xuefer at 21cn dot com (summary typo fix) bye the way, the work arround is to change code into: $match = array( 0 => array("1", "2", "3", "4", "5")); $m = &$match[0]; for ($i = 0, $c = count($m); $i < $c; $i ++) { // now, we can do our work } ------------------------------------------------------------------------ [2003-06-17 07:15:08] xuefer at 21cn dot com Description: ------------ crash in page 2nd time loading let the code say everything Reproduce code: --------------- $match = array( 0 => array("1", "2", "3", "4", "5")); $match = &$match[0]; for ($i = 0, $c = count($match); $i < $c; $i ++) { // empty loop } however, the following code will not crash: $match = array( 0 => array("1", "2", "3", "4", "5")); $match = &$match[0]; echo $c = count($match); for ($i = 0, $c = count($match); $i < $c; $i ++) { // empty loop } Expected result: ---------------- should not crash Actual result: -------------- but it did crash :( ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24222&edit=1

« previous php.bugs (#42141) next »