1--TEST--
2XSLTProcessor::$maxTemplateDepth modification validation bypass
3--EXTENSIONS--
4xsl
5--FILE--
6<?php
7
8$proc = new XSLTProcessor();
9foreach ([1,-1] as $value) {
10    echo "--- Set to $value ---\n";
11    try {
12        $proc->maxTemplateDepth = $value;
13    } catch (ValueError $e) {
14        echo $e->getMessage(), "\n";
15    }
16}
17
18echo "--- Get reference ---\n";
19
20try {
21    $ref =& $proc->maxTemplateDepth;
22} catch (Error $e) {
23    echo $e->getMessage(), "\n";
24}
25
26echo "--- Unset ---\n";
27
28try {
29    unset($proc->maxTemplateDepth);
30} catch (Error $e) {
31    echo $e->getMessage(), "\n";
32}
33
34echo "--- Dump ---\n";
35
36var_dump($proc);
37
38?>
39--EXPECT--
40--- Set to 1 ---
41--- Set to -1 ---
42XSLTProcessor::$maxTemplateDepth must be greater than or equal to 0
43--- Get reference ---
44Indirect modification of XSLTProcessor::$maxTemplateDepth is not allowed
45--- Unset ---
46Cannot unset XSLTProcessor::$maxTemplateDepth
47--- Dump ---
48object(XSLTProcessor)#1 (4) {
49  ["doXInclude"]=>
50  bool(false)
51  ["cloneDocument"]=>
52  bool(false)
53  ["maxTemplateDepth"]=>
54  int(1)
55  ["maxTemplateVars"]=>
56  int(15000)
57}
58