File: bug71571_b.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (61 lines) | stat: -rw-r--r-- 1,973 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--TEST--
Request #71571 (XSLT processor should provide option to change maxDepth) - variant B
--EXTENSIONS--
xsl
--INI--
error_reporting=E_ALL
--FILE--
<?php

$myxsl = <<<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:call-template name="recurse"/>
    </xsl:template>

    <xsl:template name="recurse">
        <xsl:param name="COUNT">1</xsl:param>
        <xsl:call-template name="recurse">
            <xsl:with-param name="COUNT" select="$COUNT + 1"/>
        </xsl:call-template>
    </xsl:template>
</xsl:stylesheet>
EOF;

$xsl = new DOMDocument();
$xsl->loadXML($myxsl);

$doc = new DOMDocument();

$proc = new XSLTProcessor;
// Set the template depth limit so high that we will certainly hit the variable depth limit first.
$proc->maxTemplateDepth = 2**30;
$proc->maxTemplateVars = 2;
$proc->importStyleSheet($xsl);
$proc->transformToDoc($doc);

?>
--EXPECTF--
Warning: XSLTProcessor::transformToDoc(): runtime error: file %s line 8 element param in %s on line %d

Warning: XSLTProcessor::transformToDoc(): xsltApplyXSLTTemplate: A potential infinite template recursion was detected.
You can adjust $maxTemplateVars in order to raise the maximum number of variables/params (currently set to 2). in %s on line %d

Warning: XSLTProcessor::transformToDoc(): Templates: in %s on line %d

Warning: XSLTProcessor::transformToDoc(): #0 name recurse  in %s on line %d

Warning: XSLTProcessor::transformToDoc(): #1 name recurse  in %s on line %d

Warning: XSLTProcessor::transformToDoc(): #2 name /  in %s on line %d

Warning: XSLTProcessor::transformToDoc(): Variables: in %s on line %d

Warning: XSLTProcessor::transformToDoc(): #0 in %s on line %d

Warning: XSLTProcessor::transformToDoc(): COUNT  in %s on line %d

Warning: XSLTProcessor::transformToDoc(): #1 in %s on line %d

Warning: XSLTProcessor::transformToDoc(): param COUNT  in %s on line %d