ID:               44891
 User updated by:  aldo at armiento dot com
 Reported By:      aldo at armiento dot com
 Status:           Open
 Bug Type:         XSLT related
 Operating System: Linux 2.6.18
 PHP Version:      5.3CVS-2008-05-02 (snap)
 New Comment:

Reproducible also with 5.2CVS-2008-05-02 (snap)


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

[2008-05-02 14:42:51] aldo at armiento dot com

Description:
------------
Using registerPHPFunctions and calling a PHP function from XSL with 
first parameter an XSL Variable (instead of node, node-text, etc.) 
produces a memory leak.

Also "memory_limit" directive in php.ini is ignored.

Reproduce code:
---------------
<?php

// XML Contents

$sXML = <<< EOD
<?xml version="1.0" encoding="UTF-8"?>
<root>root node</root>
EOD;

$domXML = new DOMDocument();
$domXML->loadXML($sXML);

// XSL Contents

$sXSL = <<< EOD
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:php="http://php.net/xsl";>

        <xsl:template match="/">
                <xsl:variable name="variable"> text </xsl:variable>
                <xsl:value-of select="php:functionString('trim', \$variable)" />
        </xsl:template>

</xsl:stylesheet>
EOD;

$domXSL = new DOMDocument();
$domXSL->loadXML($sXSL);

// XSLT Processor

$xsltProcessor = new XSLTProcessor();
$xsltProcessor->registerPHPFunctions();
$xsltProcessor->importStyleSheet($domXSL);

while (true) {
        $xsltProcessor->transformToDoc($domXML);
}



Expected result:
----------------
Nothing.

Actual result:
--------------
All server available memory is used. 


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


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

Reply via email to