1--TEST-- 2Request #71571 (XSLT processor should provide option to change maxDepth) - variant B 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:param name="COUNT">1</xsl:param> 19 <xsl:call-template name="recurse"> 20 <xsl:with-param name="COUNT" select="$COUNT + 1"/> 21 </xsl:call-template> 22 </xsl:template> 23</xsl:stylesheet> 24EOF; 25 26$xsl = new DOMDocument(); 27$xsl->loadXML($myxsl); 28 29$doc = new DOMDocument(); 30 31$proc = new XSLTProcessor; 32// Set the template depth limit so high that we will certainly hit the variable depth limit first. 33$proc->maxTemplateDepth = 2**30; 34$proc->maxTemplateVars = 2; 35$proc->importStyleSheet($xsl); 36$proc->transformToDoc($doc); 37 38?> 39--EXPECTF-- 40Warning: XSLTProcessor::transformToDoc(): runtime error: file %s line 8 element param in %s on line %d 41 42Warning: XSLTProcessor::transformToDoc(): xsltApplyXSLTTemplate: A potential infinite template recursion was detected. 43You can adjust $maxTemplateVars in order to raise the maximum number of variables/params (currently set to 2). in %s on line %d 44 45Warning: XSLTProcessor::transformToDoc(): Templates: in %s on line %d 46 47Warning: XSLTProcessor::transformToDoc(): #0 name recurse in %s on line %d 48 49Warning: XSLTProcessor::transformToDoc(): #1 name recurse in %s on line %d 50 51Warning: XSLTProcessor::transformToDoc(): #2 name / in %s on line %d 52 53Warning: XSLTProcessor::transformToDoc(): Variables: in %s on line %d 54 55Warning: XSLTProcessor::transformToDoc(): #0 in %s on line %d 56 57Warning: XSLTProcessor::transformToDoc(): COUNT in %s on line %d 58 59Warning: XSLTProcessor::transformToDoc(): #1 in %s on line %d 60 61Warning: XSLTProcessor::transformToDoc(): param COUNT in %s on line %d 62