Throw SmartyException when setting caching attributes for cacheable plugin as compiling this would fail.

Fixes #457
This commit is contained in:
Simon Wisselink
2020-02-20 23:38:53 +01:00
parent 4b29dfce11
commit 70aebc8dff
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
===== 3.1.34 release ===== 05.11.2019
13.01.2020

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);
}