#45890 [NEW]: Memory exhausted while trying to iterate simplexml object property

[email protected] ("vans9 at yandex dot ru")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             vans9 at yandex dot ru
Operating system: FreeBSD 6.2
PHP version:      5.2.6
PHP Bug Type:     SimpleXML related
Bug description:  Memory exhausted while trying to iterate simplexml object property

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 bug report at http://bugs.php.net/?id=45890&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45890&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45890&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45890&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45890&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45890&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45890&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45890&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45890&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45890&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45890&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45890&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45890&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45890&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45890&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45890&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45890&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45890&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45890&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45890&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45890&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.