Throw SmartyException when setting caching attributes for cacheable plugin as compiling this would fail (#573)

Fixes #457
This commit is contained in:
Simon Wisselink
2020-04-13 22:26:24 +02:00
committed by GitHub
parent 4396351d75
commit 4f89f6d84f
2 changed files with 3 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
- fix foreachelse on arrayiterators https://github.com/smarty-php/smarty/issues/506
- throw SmartyException when setting caching attributes for cacheable plugin https://github.com/smarty-php/smarty/issues/457
- fix errors that occured where isset was replaced with null check such as https://github.com/smarty-php/smarty/issues/453
===== 3.1.34 release ===== 05.11.2019

View File

@@ -48,6 +48,8 @@ class Smarty_Internal_Method_RegisterPlugin
throw new SmartyException("Plugin tag '{$name}' already registered");
} elseif (!is_callable($callback)) {
throw new SmartyException("Plugin '{$name}' not callable");
} elseif ($cacheable && $cache_attr) {
throw new SmartyException("Cannot set caching attributes for plugin '{$name}' when it is cacheable.");
} else {
$smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool)$cacheable, (array)$cache_attr);
}