mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- throw exception on illegal Smarty() constructor calls
This commit is contained in:
@@ -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
|
||||
|
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user