ID: 29409 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Verified +Status: Closed Bug Type: XSLT related Operating System: WinXP w/SP1 PHP Version: 5.0.0 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-07-28 09:12:38] [EMAIL PROTECTED] Fix is on the way ------------------------------------------------------------------------ [2004-07-27 17:07:14] [EMAIL PROTECTED] 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