From: fred at argus dot pt
Operating system: Linux SuSE 9.0
PHP version: 5.0.0RC2
PHP Bug Type: Reproducible crash
Bug description: foreach on container object segfaults
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 bug report at http://bugs.php.net/?id=28437&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28437&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28437&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28437&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28437&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28437&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28437&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28437&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28437&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28437&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28437&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28437&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28437&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28437&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28437&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28437&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28437&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28437&r=float