Edit report at http://bugs.php.net/bug.php?id=50670&edit=1
ID: 50670 User updated by: niklas at frubar dot net Reported by: niklas at frubar dot net Summary: Incorrect Iteration over large (10k elements) xml file -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux 2.6.9 x86_64 PHP Version: 5.3.* Block user comment: N New Comment: I can't reproduce it anymore with php 5.3.3, closing bug report. Previous Comments: ------------------------------------------------------------------------ [2010-05-17 13:37:45] m...@php.net Works with zend.enable_gc=0 ------------------------------------------------------------------------ [2010-01-14 15:18:18] niklas at frubar dot net Reproduce Code -------------- <?php $xml = <<<XML <?xml version="1.0"?> <rowset> XML; for($i = 1; $i < 15000; $i++) $xml .= '<row id="' . $i . '" />'; $xml .= <<<XML </rowset> XML; function traverse($node) { static $list; foreach ($node->children() as $child) traverse($child); $list[] = $node->attributes(); echo $node['id'] . "\n"; } traverse(new SimpleXMLElement($xml)); ?> ------------------------------------------------------------------------ [2010-01-11 09:16:28] j...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2010-01-05 20:04:17] matth at mlalonde dot net Same results in 5.2.9 as with 5.2.12. ------------------------------------------------------------------------ [2010-01-05 19:37:23] niklas at frubar dot net It works with other array values, if you replace $list[] = $node->attributes(); with $c = array(); $list[] = $c; it resets the iteration at the same node. $list[] = array(); does not reset the iteration however. $list[] = new stdClass(); does reset the iteration. Adding simple integers or strings to the array do not reset. ------------------------------------------------------------------------ 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/bug.php?id=50670 -- Edit this bug report at http://bugs.php.net/bug.php?id=50670&edit=1