xref: /php-src/ext/xsl/tests/bug71571_a.phpt (revision 30885f3b)
1--TEST--
2Request #71571 (XSLT processor should provide option to change maxDepth) - variant A
3--EXTENSIONS--
4xsl
5--INI--
6error_reporting=E_ALL
7--FILE--
8<?php
9
10$myxsl = <<<'EOF'
11<?xml version="1.0" encoding="UTF-8"?>
12<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
13    <xsl:template match="/">
14        <xsl:call-template name="recurse"/>
15    </xsl:template>
16
17    <xsl:template name="recurse">
18        <xsl:call-template name="recurse"/>
19    </xsl:template>
20</xsl:stylesheet>
21EOF;
22
23$xsl = new DOMDocument();
24$xsl->loadXML($myxsl);
25
26$doc = new DOMDocument();
27
28$proc = new XSLTProcessor;
29$proc->maxTemplateDepth = 2;
30$proc->importStyleSheet($xsl);
31$proc->transformToDoc($doc);
32
33?>
34--EXPECTF--
35Warning: XSLTProcessor::transformToDoc(): runtime error: file %s line 8 element call-template in %s on line %d
36
37Warning: XSLTProcessor::transformToDoc(): xsltApplySequenceConstructor: A potential infinite template recursion was detected.
38You can adjust $maxTemplateDepth in order to raise the maximum number of nested template calls and variables/params (currently set to 2). in %s on line %d
39
40Warning: XSLTProcessor::transformToDoc(): Templates: in %s on line %d
41
42Warning: XSLTProcessor::transformToDoc(): #0 name recurse  in %s on line %d
43
44Warning: XSLTProcessor::transformToDoc(): #1 name recurse  in %s on line %d
45
46Warning: XSLTProcessor::transformToDoc(): #2 name /  in %s on line %d
47
48Warning: XSLTProcessor::transformToDoc(): Variables: in %s on line %d
49