ID: 25289 Updated by: [EMAIL PROTECTED] Reported By: skissane at ics dot mq dot edu dot au -Status: Open +Status: Closed Bug Type: Reproducible crash Operating System: RedHat Linux 9 PHP Version: 4.3.3 New Comment:
Fixed in PHP 5. (won't fix in PHP 4) Previous Comments: ------------------------------------------------------------------------ [2003-08-29 09:43:18] [EMAIL PROTECTED] A shorter script: <?php $foo->bar1 = "foobar1"; $foo->bar2 = "foobar2"; foreach ($foo as $b->name => $b) { } ?> The foreach loop is the problem. You're creating a new stdClass object with $b->name for the key, then using $b itself for the value, thus destroying the key used in stdClass. Looks to me like a ZE1 issue. Doesn't occur in HEAD. J ------------------------------------------------------------------------ [2003-08-28 18:10:01] skissane at ics dot mq dot edu dot au Sorry about giving so many testcases (only just learning how to do this), but I finally have a 20-line reproduce script: <? class obj_database { } class obj_enum { } class obj_enumvalue { } $dm = unserialize(file_get_contents("test.dat")); foreach ($dm->obj_enum as $enum) { foreach ($enum->obj_enumvalue as $enumvalue) { } $i = 0; foreach ($enum->obj_enumvalue as $enumvalue->name => $enumvalue) { $out = " " . $enum->prefix . "_" . $enumvalue->name . " => \"" . $enumvalue->name . "\""; if ($i++ < count($enum->obj_enumvalue)-1) { } } } ?> It depends on the test.dat data file I included with my earlier test cases. ------------------------------------------------------------------------ [2003-08-28 11:00:37] skissane at ics dot mq dot edu dot au Okay, I tried a bit harder, and I have now reduced it down to a single 400 line .php file, plus three associated data files which the .php file unserializes. This results in a segmentation fault when run from the command line or Apache. You can get the latest one from http://www.iips.mq.edu.au/bugs/testcase3.tgz ------------------------------------------------------------------------ [2003-08-28 10:31:21] skissane at ics dot mq dot edu dot au I can't work out what exactly is causing it, and so can't come up with a 20 line test. I have reduced it down to a smaller set of files, at http://www.iips.mq.edu.au/bugs/testcase.tgz If you have any suggestions of how I can trim this down to a smaller test case, I'll try. ------------------------------------------------------------------------ [2003-08-28 10:07:26] [EMAIL PROTECTED] Please provide a short script (max 20 lines), without any external dependancies, such as database or includes(). (_one_ script, not dozens) ------------------------------------------------------------------------ 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/25289 -- Edit this bug report at http://bugs.php.net/?id=25289&edit=1