From: aldo at armiento dot com
Operating system: Linux 2.6.18-686
PHP version: 5.2.5
PHP Bug Type: SimpleXML related
Bug description: Memory leak assigning value to attribute
Description:
------------
Assigning any value to a SimpleXML attribute produces a memory leak.
Reproduce code:
---------------
<?php
$xml = new SimpleXMLElement('<?xml version="1.0"?><root><test
attribute="value"/></root>');
while(true) {
$xml->test['attribute'] = 'value';
}
echo $xml->asXML();
?>
Expected result:
----------------
<?xml version="1.0"?>
<root><test attribute="value"/></root>
Actual result:
--------------
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to
allocate 40 bytes) in /tmp/test_simplexml.php on line 5
--
Edit bug report at http://bugs.php.net/?id=44798&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44798&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44798&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44798&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44798&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44798&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44798&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44798&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44798&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44798&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44798&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44798&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44798&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44798&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44798&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44798&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44798&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44798&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44798&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44798&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44798&r=mysqlcfg