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