ID: 42968
Updated by: [EMAIL PROTECTED]
Reported By: quaker at barbara dot eu dot org
-Status: Open
+Status: Wont fix
Bug Type: DOM XML related
Operating System: Linux 2.6.20, Ubuntu 7.04
PHP Version: 5.2.4
New Comment:
That memory is handled from within the libxml2 library. There is no
safe way to integrate the memory routines from PHP without adversely
affecting all other modules within the web server that rely on libxml2.
Previous Comments:
------------------------------------------------------------------------
[2007-10-15 08:31:32] quaker at barbara dot eu dot org
Description:
------------
DOMXML functions can allocate more memory than memory_limit allows.
Reproduce code:
---------------
<?php
print "Current memory limit: " . ini_get("memory_limit") . "\n";
$dom = new DOMDocument();
$responseElement = $dom->createElement('response');
$dom->appendChild($responseElement);
/* Infinite loop */
while (1)
{
$dataElement = $dom->createElement('data');
$dataText = $dom->createTextNode('Example data');
$dataElement->appendChild($dataText);
$responseElement->appendChild($dataElement);
}
/* Never executed, just for showing idea */
$xmlString = $dom->saveXML();
echo $xmlString;
?>
Expected result:
----------------
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to
allocate XXX bytes) in YYY on line ZZZ
Actual result:
--------------
Memory limit is not hit. Script memory usage grows, till out of memory
received from OS.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42968&edit=1