Skip to content

Commit

Permalink
Throw SmartyException when setting caching attributes for cacheable p…
Browse files Browse the repository at this point in the history
…lugin as compiling this would fail (#573)

Fixes #457
  • Loading branch information
wisskid committed Apr 13, 2020
1 parent 4396351 commit 4f89f6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions change_log.txt
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions libs/sysplugins/smarty_internal_method_registerplugin.php
Expand Up @@ -48,6 +48,8 @@ public function 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);
}
Expand Down

0 comments on commit 4f89f6d

Please sign in to comment.