ID:               45890
 User updated by:  vans9 at yandex dot ru
 Reported By:      vans9 at yandex dot ru
 Status:           Open
 Bug Type:         SimpleXML related
 Operating System: FreeBSD 6.2
 PHP Version:      5.2.6
 New Comment:

And if you look at the output, printing the <class> entries is
expected, but class-sub-entries are printed with current, and next.


Previous Comments:
------------------------------------------------------------------------

[2008-08-22 07:58:01] vans9 at yandex dot ru

Description:
------------
While trying to iterate SimpleXML's object property (array) with
next(), memory exhausted.

Reproduce code:
---------------
$classes=new SimpleXMLElement("<?xml version=\"1.0\"
encoding=\"utf-8\"?>
<classes>
        <class>
                <name>GenericClass</name>
                <path>somepath</path>
        </class>
        <class>
                <name>GenericClass2</name>
                <path>somepath2</path>
        </class>
        <class>
                <name>GenericClass3</name>
                <path>somepath3</path>
        </class>
</classes>
");
for ($classEntry=current($classes->class); $classEntry!==false;
$classEntry=next($classes->class))
{
        print_r($classEntry);
        echo "\n";
}
echo 'Done smth.';

Expected result:
----------------
Expected: <class> elements of <classes> xml entry being printed.

Actual result:
--------------
Lot's of output and than "Allowed memory size of 134217728 bytes
exhausted (tried to allocate 16 bytes)". Output may be ommited, but
problem persists.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45890&edit=1

Reply via email to