From:             aldo at armiento dot com
Operating system: Linux 2.6.18
PHP version:      5.3CVS-2008-05-02 (snap)
PHP Bug Type:     XSLT related
Bug description:  Memory leak using registerPHPFunctions and XSLT Variable as 
function parameter

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

Reply via email to