#31033 [Opn->Fbk]: RegisterPhpFunctions: php:function(string, nodeset) with xsl:key crush PHP
ID: 31033
Updated by: sniper@php.net
Reported By: 4mirror at mail dot ru
-Status: Open
+Status: Feedback
Bug Type: XSLT related
Operating System: Windows 2000 sp4
PHP Version: 5.0.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-12-09 06:21:41] 4mirror at mail dot ru
Description:
------------
If we have
<xsl:key name="bar" match="foo" use="@baz"/>
anywere in stylesheet, any call of
php:function('anyFunction',some/node)
crush php.
In result, Apache return 500 (and Windows say: "Unhandled exception at
0x10189120 in php-cgi.exe: 0xC0000005:
Access violation reading location 0x31223d72"), or never return
anything, or PHP return many false errors.
PHP - release 5.0.2, win32 binary distribution.
Configure Command (from PHPinfo): cscript /nologo configure.js
"--enable-snapshot-build" "--with-gd=shared"
Server API: CGI/FastCGI
Apache - 1.3.27 (Win32)
libxml2 - 2.6.11, libxslt - 1.1.7, libexslt - 0.8.5
P.S. We can see "Expected result" after we delete string with mark
<!-- !!! --> in "Reproduce code"...
Reproduce code:
---------------
<?php
function myCrach($xml) { return $xml[0]->nodeName; }
$txtxsl=<<<XSL
<xsl:stylesheet version="1.0" xmlns:php="http://php.net/xsl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="data" match="tag" use="@bar"/> <!-- !!!
-->
<xsl:template match="tag">
<xsl:value-of select="php:function('myCrach',..)"/>
</xsl:template>
</xsl:stylesheet>
XSL;
$domxml=DomDocument::loadXML('<test><tag bar="foo">baz</tag>
</test>');
$domxsl=DomDocument::loadXML($txtxsl);
$xsl=new xsltProcessor();
$xsl->registerPhpFunctions();
$xsl->importStylesheet($domxsl);
echo $xsl->transformtoXML($domxml);
?>
Expected result:
----------------
test
Actual result:
--------------
server no response, php going to infinite cycle...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31033&edit=1
Thread (3 messages)