mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

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.
44 lines
947 B
PHP
44 lines
947 B
PHP
--TEST--
|
|
XSLTProcessor::$maxTemplateDepth errors
|
|
--EXTENSIONS--
|
|
xsl
|
|
--INI--
|
|
error_reporting=E_ALL & ~E_DEPRECATED
|
|
--FILE--
|
|
<?php
|
|
|
|
$processor = new XSLTProcessor;
|
|
$oldValue = $processor->maxTemplateDepth;
|
|
|
|
try {
|
|
$processor->maxTemplateDepth = -1;
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
var_dump($processor->maxTemplateDepth === $oldValue);
|
|
|
|
try {
|
|
$processor->maxTemplateDepth = -32.1;
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
var_dump($processor->maxTemplateDepth === $oldValue);
|
|
|
|
try {
|
|
$processor->maxTemplateDepth = "-1";
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
var_dump($processor->maxTemplateDepth === $oldValue);
|
|
|
|
?>
|
|
--EXPECT--
|
|
XSLTProcessor::$maxTemplateDepth must be greater than or equal to 0
|
|
bool(true)
|
|
XSLTProcessor::$maxTemplateDepth must be greater than or equal to 0
|
|
bool(true)
|
|
XSLTProcessor::$maxTemplateDepth must be greater than or equal to 0
|
|
bool(true)
|