1--TEST-- 2Bug #71540 (NULL pointer dereference in xsl_ext_function_php()) 3--SKIPIF-- 4<?php 5if (!extension_loaded('xsl')) die("skip Extension XSL is required\n"); 6if (LIBXML_VERSION >= 20903) die('skip this test is for PHP linked with libxml2 < 2.9.3 only') 7?> 8--FILE-- 9<?php 10$xml = <<<EOB 11<allusers> 12 <user> 13 <uid>bob</uid> 14 </user> 15</allusers> 16EOB; 17$xsl = <<<EOB 18<?xml version="1.0" encoding="UTF-8"?> 19<xsl:stylesheet version="1.0" 20 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 21 xmlns:php="http://php.net/xsl"> 22<xsl:output method="html" encoding="utf-8" indent="yes"/> 23 <xsl:template match="allusers"> 24 <html><body> 25 <h2>Users</h2> 26 <table> 27 <xsl:for-each select="user"> 28 <tr><td> 29 <xsl:value-of 30 select="php:function('test',uid,test(test))"/> 31 </td></tr> 32 </xsl:for-each> 33 </table> 34 </body></html> 35 </xsl:template> 36</xsl:stylesheet> 37EOB; 38 39$xmldoc = new DOMDocument(); 40$xmldoc->loadXML($xml); 41$xsldoc = new DOMDocument(); 42$xsldoc->loadXML($xsl); 43 44$proc = new XSLTProcessor(); 45$proc->registerPHPFunctions(); 46$proc->importStyleSheet($xsldoc); 47echo $proc->transformToXML($xmldoc); 48?> 49DONE 50--EXPECTF-- 51Warning: XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function test not found in %sbug71540.php on line %d 52 53Warning: XSLTProcessor::transformToXml(): Unregistered function in %sbug71540.php on line %d 54 55Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d 56 57Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d 58 59Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %sbug71540.php on line %d 60 61Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 2 objects left on the stack. in %sbug71540.php on line %d 62 63Warning: XSLTProcessor::transformToXml(): runtime error: file %s line 13 element value-of in %sbug71540.php on line %d 64 65Warning: XSLTProcessor::transformToXml(): XPath evaluation returned no result. in %sbug71540.php on line %d 66<html xmlns:php="http://php.net/xsl"><body> 67<h2>Users</h2> 68<table><tr><td></td></tr></table> 69</body></html> 70DONE 71