From f14c4bfb9c20d695cfff09fde6c51aa3c80825d9 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Tue, 29 Nov 2011 17:47:37 +0000 Subject: [PATCH] - bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_templatecompilerbase.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/change_log.txt b/change_log.txt index 0714689e..f43245f9 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +29.11.2011 +- bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512) + 25.11.2011 - bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified since r4432 (issue 60) diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 0f218384..1f50be75 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -521,14 +521,17 @@ abstract class Smarty_Internal_TemplateCompilerBase { } include_once $script; } else { - throw new SmartyCompilerException("Plugin or modifer script file $script not found"); + $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found"); } } + if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) { + $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name"); + } if (is_callable($callback)) { $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array()); return true; } else { - throw new SmartyCompilerException("Function for plugin or modifier $tag not callable"); + $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable"); } } return false;