cvs: ZendEngine2 / zend_compile.c zend_execute.c
| From: | Rob Richards | Date: | Sun, 29 Feb 2004 19:41:06 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2428@lists.php.net to get a copy of this message | ||
The Fix leak in foreach ($o->mthd()->arr) change:
http://news.php.net/article.php?group=php.zend-engine.cvs&article=2409
seems to break nested foreach loops when using iterators. They work fine without this change.
$xml_mem =
simplexml_load_string('<bookbody><part><chapter><page>1</page></chapter></part></bookbody>');
/* The following works fine */
foreach ($xml_mem->part as $part) {
foreach($part->chapter->page as $page) {
print $page;
}
}
/* The following segfaults */
foreach ($xml_mem->part as $part) {
foreach($part->chapter as $chapter) { // Difference here from previous example
print $chapter;
}
}
In the example that segfaults, $part is now getting dtor'd an additional time. When it hits the
outer loop, it has already been destroyed and now segfaults when it accesses the current $part when
trying to move next. The same thing happens in the dom extension as well.
Rob