From:             4mirror at mail dot ru
Operating system: Windows 2000 sp4
PHP version:      5.0.2
PHP Bug Type:     XSLT related
Bug description:  RegisterPhpFunctions: php:function(string, nodeset) with 
xsl:key crush PHP

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 bug report at http://bugs.php.net/?id=31033&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31033&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31033&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31033&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31033&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31033&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31033&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31033&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31033&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31033&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31033&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31033&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31033&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31033&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31033&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31033&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31033&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31033&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31033&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31033&r=mysqlcfg

Reply via email to