#29409 [NEW]: PHP segfaults when domDocument::documentElement return as variable
| From: | davey@php.net | Date: | Tue, 27 Jul 2004 15:07:17 +0000 |
| Subject: | #29409 [NEW]: PHP segfaults when domDocument::documentElement return as variable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-63629@lists.php.net to get a copy of this message | ||
From: davey@php.net
Operating system: WinXP w/SP1
PHP version: 5.0.0
PHP Bug Type: XSLT related
Bug description: PHP segfaults when domDocument::documentElement return as variable
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 bug report at http://bugs.php.net/?id=29409&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29409&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29409&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29409&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29409&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29409&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29409&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29409&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29409&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29409&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29409&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29409&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29409&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29409&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29409&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29409&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29409&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29409&r=float