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