diff --git a/change_log.txt b/change_log.txt index f33d5232..d76a993e 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,6 @@ 11/02/2009 - added neq,lte,gte,mod as aliases to if conditions +- throw exception on illegal Smarty() constructor calls 10/31/2009 - change of filenames in sysplugins folder for internal spl_autoload function diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 970ff03f..de4d14a5 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -524,15 +524,15 @@ class Smarty extends Smarty_Internal_TemplateBase { */ public function __call($name, $args) { + if ($name == 'Smarty') { + throw new Exception('Please use parent::__construct() to call parent constuctor'); + } if (!is_callable($name)) { $_plugin_filename = strtolower('smarty_method_' . $name . $this->php_ext); if (!file_exists(SMARTY_SYSPLUGINS_DIR . $_plugin_filename)) { - throw new Exception("Sysplugin file " . $_plugin_filename . " does not exist"); + throw new Exception('Undefined Smarty method "'. $name .'"'); } require_once(SMARTY_SYSPLUGINS_DIR . $_plugin_filename); - if (!is_callable($name)) { - throw new Exception ("Sysplugin file " . $_plugin_filename . " does not define function " . $name); - } } return call_user_func_array($name, array_merge(array($this), $args)); }