ID: 44891
Updated by: [EMAIL PROTECTED]
Reported By: aldo at armiento dot com
-Status: Open
+Status: Verified
Bug Type: XSLT related
Operating System: Linux 2.6.18
PHP Version: 5.3CVS-2008-05-02 (snap)
New Comment:
5.3 backtrace:
==25539== 409,600 bytes in 100 blocks are definitely lost in loss
record 1 of 1
==25539== at 0x4021620: malloc (vg_replace_malloc.c:149)
==25539== by 0x414B180: xmlBufferCreate (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x414BE43: xmlNodeGetContent (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x417AE60: xmlXPathCastNodeToString (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x417B194: xmlXPathCastNodeSetToString (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x417E4AC: xmlXPathCastToString (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x822F1EE: xsl_ext_function_php (xsltprocessor.c:289)
==25539== by 0x41835E1: (within /usr/lib/libxml2.so.2.6.27)
==25539== by 0x418306A: (within /usr/lib/libxml2.so.2.6.27)
==25539== by 0x4184E2F: (within /usr/lib/libxml2.so.2.6.27)
==25539== by 0x4189265: (within /usr/lib/libxml2.so.2.6.27)
==25539== by 0x4189471: xmlXPathCompiledEval (in
/usr/lib/libxml2.so.2.6.27)
==25539== by 0x40FBA1A: xsltValueOf (in /usr/lib/libxslt.so.1.1.20)
==25539== by 0x40F8AE6: (within /usr/lib/libxslt.so.1.1.20)
==25539== by 0x40FA002: (within /usr/lib/libxslt.so.1.1.20)
==25539== by 0x40FA7FC: xsltProcessOneNode (in
/usr/lib/libxslt.so.1.1.20)
==25539== by 0x40FE9F1: (within /usr/lib/libxslt.so.1.1.20)
==25539== by 0x822FDD1: php_xsl_apply_stylesheet
(xsltprocessor.c:540)
==25539== by 0x823021F: zif_xsl_xsltprocessor_transform_to_doc
(xsltprocessor.c:594)
==25539== by 0x82B38BA: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:189)
==25539== by 0x82B2E44: execute (zend_vm_execute.h:91)
==25539== by 0x828D19E: zend_execute_scripts (zend.c:1195)
==25539== by 0x8233870: php_execute_script (main.c:2077)
==25539== by 0x83206D8: main (php_cli.c:1139)
Previous Comments:
------------------------------------------------------------------------
[2008-05-02 14:46:04] aldo at armiento dot com
Reproducible also with 5.2CVS-2008-05-02 (snap)
------------------------------------------------------------------------
[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