#28437 [Opn->Fbk]: foreach on container object segfaults

From: Date: Tue, 18 May 2004 19:07:39 +0000
Subject: #28437 [Opn->Fbk]: foreach on container object segfaults
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59742@lists.php.net to get a copy of this message
ID: 28437 Updated by: wez@php.net Reported By: fred at argus dot pt -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Linux SuSE 9.0 PHP Version: 5.0.0RC2 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-05-18 21:01:57] fred at argus dot pt Description: ------------ If I create an object with a container(array) instance variable, and then use foreach to iterate over the container, then a segfault occurs. If I copy the container to a temporary variable, and foreach over the temp, the code works fine. Similar code worked fine in PHP4, and I think 5.0.0RC1. Reproduce code: --------------- <?php class user { public $msgs = array(); } class message { public $text; } $user = new user; $msg = new message; $msg->text = "Hello"; $user->msgs[] = $msg; foreach($user->msgs as $msg) { echo "<br>Text is $msg->text"; } echo "<br>Tests completed"; ?> Expected result: ---------------- Text is Hello Tests completed Actual result: -------------- Blank Screen Segfault message in main server error log. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28437&edit=1

« previous php.bugs (#59742) next »