From: theo at crazygreek dot co dot uk
Operating system: Linux
PHP version: 5.0.5
PHP Bug Type: XSLT related
Bug description: double free when passing node from external document() to a
PHP function
Description:
------------
Performing a PHP callback from within an XSLT template with a parameter of
an element that is inside a external XML document causes a double free,
followed by crash. Running latest stable PHP.
Reproduce code:
---------------
=========
crash.php
=========
$xslt = new XsltProcessor();
$xslt->registerPHPFunctions();
$xslt->importStyleSheet(DOMDocument::load('test.xsl'));
echo $xslt->transformToDoc(new DOMDocument())->saveXml();
function crashMe() {
return null;
}
=========
crash.xsl
=========
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl" version="1.0">
<xsl:template match="/">
<xsl:copy-of select="php:function('crashMe',
document('crash.xml'))"/>
</xsl:template>
</xsl:stylesheet>
=========
crash.xml
=========
<?xml version="1.0"?>
<crashed/>
Expected result:
----------------
Just the following:
<?xml version="1.0"?>
Actual result:
--------------
A crash!
*** glibc detected *** double free or corruption (fasttop): 0x085d8540
***
Aborted
--
Edit bug report at http://bugs.php.net/?id=34952&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34952&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34952&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34952&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34952&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34952&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34952&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34952&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34952&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34952&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34952&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34952&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34952&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34952&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34952&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34952&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34952&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34952&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34952&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34952&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34952&r=mysqlcfg