Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.7

Bug #252 iunfinite recursion with xml -file
Submitted: 2003-11-14 15:29 UTC
From: konrek at gmx dot net Assigned: cain
Status: Closed Package: Tree
PHP Version: Irrelevant OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2003-11-14 15:29 UTC] konrek at gmx dot net
Description: ------------ <?xml version="1.0" encoding="UTF-8"?> <page id="1"> <step id="2"> <hello is="3">hallo </hello> </step> </page> causes infinite recursion Reproduce code: --------------- echo "<h2>Test for Tree</h2>"; imppear( 'Tree/Tree' ); // setup a memory tree using nested sets $tree = Tree::setup( 'Memory_XML', 'test.xml' ); // read the data from the DB and build the tree internally $data = $tree->setup(); print_r($data); //print_r($tree->setupByRawData($array )); echo "<br /> "; print_r($tree); Expected result: ---------------- normal Parsing of XML in Tree-Object Actual result: -------------- output: 1 tree_memory Object ( [data] => Array ( [1] => Array ( [id] => 1 [name] => page [level] => 0 [attributes] => Array ( [id] => 1 ) [parentId] => 0 [cdata] => [childId] => 2 [child] => Array ( [id] => 2 [name] => step [level] => 1 [attributes] => Array ( [id] => 2 ) [parentId] => 1 [cdata] => [parent] => Array *RECURSION* [childId] => 3 [child] => Array ( [id] => 3 [name] => hello [level] => 2 [attributes] => Array ( [is] => 3 ) [parentId] => 2 [cdata] => hallo [parent] => Array *RECURSION* ) [children] => Array ( [0] => Array ( [id] => 3 [name] => hello [level] => 2 [attributes] => Array ( [is] => 3 ) [parentId] => 2 [cdata] => hallo [parent] => Array ( [id] => 2 [name] => step [level] => 1 [attributes] => Array ( [id] => 2 ) [parentId] => 1 [cdata] => [parent] => Array ( [id] => 1 [name] => page [level] => 0 [attributes] => Array ( [id] => 1 ) [parentId] => 0 [cdata] => [childId] => 2 [child] => Array *RECURSION* [children] => Array ( [0] => Array ( [id] => 2 [name] => step [level] => 1 [attributes] => Array ( [id] => 2 ) [parentId] => 1 [cdata] => [parent] => Array *RECURSION* [childId] => 3 [child] => Array *RECURSION* [children] => Array *RECURSION* ) ) ) [childId] => 3 [child] => Array ( [id] => 3 [name] => hello [level] => 2 [attributes] => Array ( [is] => 3 ) and so on

Comments

 [2003-11-14 16:53 UTC] cain at php dot net
you should not use print_r here, but use $tree->varDump() instead, since the structure *is* recursive.