From:             quaker at barbara dot eu dot org
Operating system: Linux 2.6.20, Ubuntu 7.04
PHP version:      5.2.4
PHP Bug Type:     DOM XML related
Bug description:  DOMXML functions can allocate more memory than memory_limit 
allows

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 bug report at http://bugs.php.net/?id=42968&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42968&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42968&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42968&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42968&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42968&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42968&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42968&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42968&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42968&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42968&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42968&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42968&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42968&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42968&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42968&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42968&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42968&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42968&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42968&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42968&r=mysqlcfg

Reply via email to