#29409 [Opn->Ver]: PHP segfaults when domDocument::documentElement return as variable
| From: | chregu@php.net | Date: | Wed, 28 Jul 2004 07:12:39 +0000 |
| Subject: | #29409 [Opn->Ver]: PHP segfaults when domDocument::documentElement return as variable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63664@lists.php.net to get a copy of this message | ||
ID: 29409
Updated by: chregu@php.net
Reported By: davey@php.net
-Status: Open
+Status: Verified
Bug Type: XSLT related
Operating System: WinXP w/SP1
PHP Version: 5.0.0
New Comment:
Fix is on the way
Previous Comments:
------------------------------------------------------------------------
[2004-07-27 17:07:14] davey@php.net
Description:
------------
When you assign a the DomDocument::documentElement to a variable before
returning it from a function called by the XSL extension, PHP
segfaults.
See code for better explanation.
- Davey
Reproduce code:
---------------
<?php
$xsl = <<<XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:php="http://php.net/xsl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:crtx="http://synapticmedia.net/xmlns/crtx/template">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"
omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="php:function('returnDomElement')" />
</xsl:template>
</xsl:stylesheet>
XSL;
$xml = <<<XML
<root></root>
XML;
function returnDomElement() {
$xml = '<root><child>cdata</child></root>';
$dom = domDocument::loadXML($xml);
/* change to 'return $dom->documentElement' and it works */
$return = $dom->documentElement;
return $return
}
$xsl = domDocument::loadXML($xsl);
$xml = domDocument::loadXML($xml);
$xp = new xsltProcessor;
$xp->registerPhpFunctions();
$xp->importStylesheet($xsl);
echo $xp->transformToXML($xml);
?>
Expected result:
----------------
<root>
<child>cdata</child>
</root>
Actual result:
--------------
</> in the output and a segfault (details will be added by chregu)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29409&edit=1