-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement request #71571: XSLT processor should provide option to cha…
…nge maxDepth (#13731) There are two depth limiting parameters for XSLT templates. 1) maxTemplateDepth This corresponds to the recursion depth of a template. For very complicated templates this can be hit. 2) maxTemplateVars This is the total number of live variables. When using recursive templates with lots of parameters you can hit this limit. This patch introduces two new properties to XSLTProcessor that corresponds to the above variables.
- Loading branch information
Showing
18 changed files
with
532 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--TEST-- | ||
Request #71571 (XSLT processor should provide option to change maxDepth) - variant A | ||
--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:call-template name="recurse"/> | ||
</xsl:template> | ||
</xsl:stylesheet> | ||
EOF; | ||
|
||
$xsl = new DOMDocument(); | ||
$xsl->loadXML($myxsl); | ||
|
||
$doc = new DOMDocument(); | ||
|
||
$proc = new XSLTProcessor; | ||
$proc->maxTemplateDepth = 2; | ||
$proc->importStyleSheet($xsl); | ||
$proc->transformToDoc($doc); | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: XSLTProcessor::transformToDoc(): runtime error: file %s line 8 element call-template in %s on line %d | ||
|
||
Warning: XSLTProcessor::transformToDoc(): xsltApplySequenceConstructor: A potential infinite template recursion was detected. | ||
You 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 | ||
|
||
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 |
Oops, something went wrong.