From: rob dot eyre at gmail dot com Operating system: Linux PHP version: 5.1.2 PHP Bug Type: XSLT related Bug description: Unable to call static php class functions from xsl
Description: ------------ After calling registerPHPFunctions() and including the php namespace on an XSL stylesheet, I can call global functions (eg date()), but not static class functions (ie testClass::testMethod()). Reproduce code: --------------- class testClass { function testMethod() { return 'testValue'; } } $xslt = new XSLTProcessor; $xslt->registerPHPFunctions(); $xmlDoc = DOMDocument::loadXML('<root />'); $xslDoc = DOMDocument::loadXML(' <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"> <xsl:template match="/"> <div><xsl:value-of select="php:function(\'testClass::testMethod\')" /></div> </xsl:template> </xsl:stylesheet>'); $xslt->importStylesheet($xslDoc); echo $xslt->transformToXML($xmlDoc); Expected result: ---------------- <div>testValue</div> Actual result: -------------- Warning: XSLTProcessor::transformToXml() [function.transformToXml]: Unable to call handler testClass::testMethod() in /home/rob/Projects/sandbox/index.php on line 19 Warning: XSLTProcessor::transformToXml() [function.transformToXml]: xmlXPathCompiledEval: evaluation failed in /home/rob/Projects/sandbox/index.php on line 19 Warning: XSLTProcessor::transformToXml() [function.transformToXml]: runtime error: file /home/rob/Projects/sandbox/ line 4 element value-of in /home/rob/Projects/sandbox/index.php on line 19 Warning: XSLTProcessor::transformToXml() [function.transformToXml]: xsltValueOf: text copy failed in /home/rob/Projects/sandbox/index.php on line 19 -- Edit bug report at http://bugs.php.net/?id=37091&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37091&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37091&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37091&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37091&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37091&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37091&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37091&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37091&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37091&r=support Expected behavior: http://bugs.php.net/fix.php?id=37091&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37091&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37091&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37091&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37091&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37091&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37091&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37091&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37091&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37091&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37091&r=mysqlcfg