From ad921936b0e840c82eec99ed188dcada02a6891e Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Fri, 13 Aug 2010 10:39:51 +0000 Subject: [PATCH] - remove exception_handler property from Smarty class - added Smarty's own exceptions SmartyException and SmartyCompilerException --- change_log.txt | 4 +++ libs/Smarty.class.php | 31 +++++++++---------- libs/plugins/block.php.php | 4 +-- libs/plugins/function.html_image.php | 6 ++-- libs/sysplugins/smarty_internal_cache.php | 2 +- libs/sysplugins/smarty_internal_config.php | 6 ++-- .../smarty_internal_config_file_compiler.php | 2 +- libs/sysplugins/smarty_internal_data.php | 8 ++--- .../smarty_internal_filter_handler.php | 2 +- libs/sysplugins/smarty_internal_register.php | 28 ++++++++--------- .../smarty_internal_resource_extends.php | 2 +- .../smarty_internal_resource_php.php | 6 ++-- .../smarty_internal_security_handler.php | 6 ++-- libs/sysplugins/smarty_internal_template.php | 15 +++++---- .../smarty_internal_templatecompilerbase.php | 6 ++-- libs/sysplugins/smarty_internal_wrapper.php | 2 +- .../sysplugins/smarty_internal_write_file.php | 4 +-- 17 files changed, 68 insertions(+), 66 deletions(-) diff --git a/change_log.txt b/change_log.txt index 36f6256b..77fdc5ed 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,7 @@ +13/08/2010 +- remove exception_handler property from Smarty class +- added Smarty's own exceptions SmartyException and SmartyCompilerException + 09/08/2010 - bugfix on modifier with doublequoted strings as parameter containing embedded tags diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index df5c82e5..62397dee 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -193,8 +193,6 @@ class Smarty extends Smarty_Internal_Data { public $properties = array(); // config type public $default_config_type = 'file'; - // exception handler: array('ExceptionClass','ExceptionMethod'); - public $exception_handler = null; // cached template objects public $template_objects = null; // check If-Modified-Since headers @@ -247,9 +245,6 @@ class Smarty extends Smarty_Internal_Data { mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET); } $this->start_time = microtime(true); - // set exception handler - if (!empty($this->exception_handler)) - set_exception_handler($this->exception_handler); // set default dirs $this->template_dir = array('.' . DS . 'templates' . DS); $this->compile_dir = '.' . DS . 'templates_c' . DS; @@ -292,9 +287,6 @@ class Smarty extends Smarty_Internal_Data { */ public function __destruct() { - // restore to previous exception handler, if any - if (!empty($this->exception_handler)) - restore_exception_handler(); } /** @@ -467,7 +459,7 @@ class Smarty extends Smarty_Internal_Data { $this->security_handler = new Smarty_Internal_Security_Handler($this); $this->security = true; } else { - throw new Exception('Property security_class is not defined'); + throw new SmartyException('Property security_class is not defined'); } } @@ -538,7 +530,7 @@ class Smarty extends Smarty_Internal_Data { $_name_parts = explode('_', $_plugin_name, 3); // class name must have three parts to be valid plugin if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') { - throw new Exception("plugin {$plugin_name} is not a valid name format"); + throw new SmartyException("plugin {$plugin_name} is not a valid name format"); return false; } // if type is "internal", get plugin from sysplugins @@ -587,7 +579,7 @@ class Smarty extends Smarty_Internal_Data { return $this->registered_filters[$type][$_filter_name] = $_plugin; } } - throw new Exception("{$type}filter \"{$name}\" not callable"); + throw new SmartyException("{$type}filter \"{$name}\" not callable"); return false; } @@ -611,7 +603,7 @@ class Smarty extends Smarty_Internal_Data { */ public function trigger_error($error_msg, $error_type = E_USER_WARNING) { - throw new Exception("Smarty error: $error_msg"); + throw new SmartyException("Smarty error: $error_msg"); } /** @@ -677,10 +669,10 @@ class Smarty extends Smarty_Internal_Data { function getRegisteredObject($name) { if (!isset($this->registered_objects[$name])) - throw new Exception("'$name' is not a registered object"); + throw new SmartyException("'$name' is not a registered object"); if (!is_object($this->registered_objects[$name][0])) - throw new Exception("registered '$name' is not an object"); + throw new SmartyException("registered '$name' is not an object"); return $this->registered_objects[$name][0]; } @@ -740,7 +732,7 @@ class Smarty extends Smarty_Internal_Data { $camel_func = create_function('$c', 'return "_" . strtolower($c[1]);'); // PHP4 call to constructor? if (strtolower($name) == 'smarty') { - throw new Exception('Please use parent::__construct() to call parent constuctor'); + throw new SmartyException('Please use parent::__construct() to call parent constuctor'); return false; } // see if this is a set/get for a property @@ -752,7 +744,7 @@ class Smarty extends Smarty_Internal_Data { // convert camel case to underscored name $property_name = preg_replace_callback('/([A-Z])/', $camel_func, $property_name); if (!property_exists($this, $property_name)) { - throw new Exception("property '$property_name' does not exist."); + throw new SmartyException("property '$property_name' does not exist."); return false; } if ($first3 == 'get') @@ -776,4 +768,11 @@ function smartyAutoload($class) } } +Class SmartyException extends Exception { +} + +Class SmartyCompilerException extends SmartyException { +} + + ?> \ No newline at end of file diff --git a/libs/plugins/block.php.php b/libs/plugins/block.php.php index d1de7400..7e907bfe 100644 --- a/libs/plugins/block.php.php +++ b/libs/plugins/block.php.php @@ -19,9 +19,9 @@ function smarty_block_php($params, $content, $smarty, &$repeat, $template) { if (!$smarty->allow_php_tag) { - throw new Exception("{php} is deprecated, set allow_php_tag = true to enable"); + throw new SmartyException("{php} is deprecated, set allow_php_tag = true to enable"); } eval($content); return ''; } -?> +?> \ No newline at end of file diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php index 3f031dc0..be31b18e 100644 --- a/libs/plugins/function.html_image.php +++ b/libs/plugins/function.html_image.php @@ -64,7 +64,7 @@ function smarty_function_html_image($params, $smarty, $template) if (!is_array($_val)) { $$_key = smarty_function_escape_special_chars($_val); } else { - throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); } break; @@ -78,7 +78,7 @@ function smarty_function_html_image($params, $smarty, $template) if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); } break; } @@ -136,4 +136,4 @@ function smarty_function_html_image($params, $smarty, $template) return $prefix . '' . $alt . '' . $suffix; } -?> +?> \ No newline at end of file diff --git a/libs/sysplugins/smarty_internal_cache.php b/libs/sysplugins/smarty_internal_cache.php index cb7ee96e..6e40c31b 100644 --- a/libs/sysplugins/smarty_internal_cache.php +++ b/libs/sysplugins/smarty_internal_cache.php @@ -64,7 +64,7 @@ class Smarty_Internal_Cache { return $this->smarty->cache_resource_objects[$type] = new $cache_resource_class($this->smarty); } else { - throw new Exception("Unable to load cache resource '{$type}'"); + throw new SmartyException("Unable to load cache resource '{$type}'"); } } } diff --git a/libs/sysplugins/smarty_internal_config.php b/libs/sysplugins/smarty_internal_config.php index 4c10505f..a74270fa 100644 --- a/libs/sysplugins/smarty_internal_config.php +++ b/libs/sysplugins/smarty_internal_config.php @@ -29,7 +29,7 @@ class Smarty_Internal_Config { $this->compiler_object = null; // parse config resource name if (!$this->parseConfigResourceName ($config_resource)) { - throw new Exception ("Unable to parse config resource '{$config_resource}'"); + throw new SmartyException ("Unable to parse config resource '{$config_resource}'"); } } @@ -87,7 +87,7 @@ class Smarty_Internal_Config { if (file_exists($this->config_resource_name)) return $this->config_resource_name; // no tpl file found - throw new Exception("Unable to load config file \"{$this->config_resource_name}\""); + throw new SmartyException("Unable to load config file \"{$this->config_resource_name}\""); return false; } /** @@ -106,7 +106,7 @@ class Smarty_Internal_Config { { if ($this->config_source === null) { if ($this->readConfigSource($this) === false) { - throw new Exception("Unable to load config file \"{$this->config_resource_name}\""); + throw new SmartyException("Unable to load config file \"{$this->config_resource_name}\""); } } return $this->config_source; diff --git a/libs/sysplugins/smarty_internal_config_file_compiler.php b/libs/sysplugins/smarty_internal_config_file_compiler.php index 17cfc81c..af956464 100644 --- a/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -98,7 +98,7 @@ class Smarty_Internal_Config_File_Compiler { // output parser error message $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect); } - throw new Exception($error_text); + throw new SmartyCompilerException($error_text); } } diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 7cfee408..8c35f83f 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -287,7 +287,7 @@ class Smarty_Internal_Data { return $this->smarty->global_tpl_vars[$variable]; } if ($this->smarty->error_unassigned && $error_enable) { - throw new Exception('Undefined Smarty variable "' . $variable . '"'); + throw new SmartyException('Undefined Smarty variable "' . $variable . '"'); } else { return new Undefined_Smarty_Variable; } @@ -310,7 +310,7 @@ class Smarty_Internal_Data { $_ptr = $_ptr->parent; } if ($this->smarty->error_unassigned) { - throw new Exception('Undefined config variable "' . $variable . '"'); + throw new SmartyException('Undefined config variable "' . $variable . '"'); } else { return ''; } @@ -333,7 +333,7 @@ class Smarty_Internal_Data { } if ($this->smarty->$error_unassigned) { - throw new Exception('Undefined stream variable "' . $variable . '"'); + throw new SmartyException('Undefined stream variable "' . $variable . '"'); } else { return ''; } @@ -407,7 +407,7 @@ class Smarty_Data extends Smarty_Internal_Data { $this->tpl_vars[$_key] = new Smarty_variable($_val); } } elseif ($_parent != null) { - throw new Exception("Wrong type for template variables"); + throw new SmartyException("Wrong type for template variables"); } } } diff --git a/libs/sysplugins/smarty_internal_filter_handler.php b/libs/sysplugins/smarty_internal_filter_handler.php index 0ab058cb..1992b55e 100644 --- a/libs/sysplugins/smarty_internal_filter_handler.php +++ b/libs/sysplugins/smarty_internal_filter_handler.php @@ -44,7 +44,7 @@ class Smarty_Internal_Filter_Handler { } } else { // nothing found, throw exception - throw new Exception("Unable to load filter {$plugin_name}"); + throw new SmartyException("Unable to load filter {$plugin_name}"); } } } diff --git a/libs/sysplugins/smarty_internal_register.php b/libs/sysplugins/smarty_internal_register.php index fb660cbf..e6ae0318 100644 --- a/libs/sysplugins/smarty_internal_register.php +++ b/libs/sysplugins/smarty_internal_register.php @@ -51,9 +51,9 @@ class Smarty_Internal_Register { function block($block_tag, $block_impl, $cacheable = true, $cache_attr = array()) { if (isset($this->smarty->registered_plugins['block'][$block_tag])) { - throw new Exception("Plugin tag \"{$block_tag}\" already registered"); + throw new SmartyException("Plugin tag \"{$block_tag}\" already registered"); } elseif (!is_callable($block_impl)) { - throw new Exception("Plugin \"{$block_tag}\" not callable"); + throw new SmartyException("Plugin \"{$block_tag}\" not callable"); } else { $this->smarty->registered_plugins['block'][$block_tag] = array($block_impl, $cacheable, $cache_attr); @@ -70,9 +70,9 @@ class Smarty_Internal_Register { function compilerFunction($compiler_tag, $compiler_impl, $cacheable = true) { if (isset($this->smarty->registered_plugins['compiler'][$compiler_tag])) { - throw new Exception("Plugin tag \"{$compiler_tag}\" already registered"); + throw new SmartyException("Plugin tag \"{$compiler_tag}\" already registered"); } elseif (!is_callable($compiler_impl)) { - throw new Exception("Plugin \"{$compiler_tag}\" not callable"); + throw new SmartyException("Plugin \"{$compiler_tag}\" not callable"); } else { $this->smarty->registered_plugins['compiler'][$compiler_tag] = array($compiler_impl, $cacheable); @@ -90,9 +90,9 @@ class Smarty_Internal_Register { function templateFunction($function_tag, $function_impl, $cacheable = true, $cache_attr = array()) { if (isset($this->smarty->registered_plugins['function'][$function_tag])) { - throw new Exception("Plugin tag \"{$function_tag}\" already registered"); + throw new SmartyException("Plugin tag \"{$function_tag}\" already registered"); } elseif (!is_callable($function_impl)) { - throw new Exception("Plugin \"{$function_tag}\" not callable"); + throw new SmartyException("Plugin \"{$function_tag}\" not callable"); } else { $this->smarty->registered_plugins['function'][$function_tag] = array($function_impl, $cacheable, $cache_attr); @@ -108,9 +108,9 @@ class Smarty_Internal_Register { function modifier($modifier_name, $modifier_impl) { if (isset($this->smarty->registered_plugins['modifier'][$modifier_name])) { - throw new Exception("Plugin \"{$modifier_name}\" already registered"); + throw new SmartyException("Plugin \"{$modifier_name}\" already registered"); } elseif (!is_callable($modifier_impl)) { - throw new Exception("Plugin \"{$modifier_name}\" not callable"); + throw new SmartyException("Plugin \"{$modifier_name}\" not callable"); } else { $this->smarty->registered_plugins['modifier'][$modifier_name] = array($modifier_impl); @@ -132,7 +132,7 @@ class Smarty_Internal_Register { if (!empty($allowed)) { foreach ((array)$allowed as $method) { if (!is_callable(array($object_impl, $method))) { - throw new Exception("Undefined method '$method' in registered object"); + throw new SmartyException("Undefined method '$method' in registered object"); } } } @@ -140,7 +140,7 @@ class Smarty_Internal_Register { if (!empty($block_methods)) { foreach ((array)$block_methods as $method) { if (!is_callable(array($object_impl, $method))) { - throw new Exception("Undefined method '$method' in registered object"); + throw new SmartyException("Undefined method '$method' in registered object"); } } } @@ -159,7 +159,7 @@ class Smarty_Internal_Register { { // test if exists if (!class_exists($class_impl)) { - throw new Exception("Undefined class '$class_impl' in register template class"); + throw new SmartyException("Undefined class '$class_impl' in register template class"); } // register the class $this->smarty->registered_classes[$class_name] = $class_impl; @@ -217,7 +217,7 @@ class Smarty_Internal_Register { array(&$function_names[0], $function_names[4])), false); } else { - throw new Exception("malformed function-list for '$resource_type' in register_resource"); + throw new SmartyException("malformed function-list for '$resource_type' in register_resource"); } } @@ -242,7 +242,7 @@ class Smarty_Internal_Register { if (is_callable($function_name)) { $this->smarty->default_plugin_handler_func = $function_name; } else { - throw new Exception("Default plugin handler '$function_name' not callable"); + throw new SmartyException("Default plugin handler '$function_name' not callable"); } } @@ -256,7 +256,7 @@ class Smarty_Internal_Register { if (is_callable($function_name)) { $this->smarty->default_template_handler_func = $function_name; } else { - throw new Exception("Default template handler '$function_name' not callable"); + throw new SmartyException("Default template handler '$function_name' not callable"); } } } diff --git a/libs/sysplugins/smarty_internal_resource_extends.php b/libs/sysplugins/smarty_internal_resource_extends.php index 44490758..b684aadd 100644 --- a/libs/sysplugins/smarty_internal_resource_extends.php +++ b/libs/sysplugins/smarty_internal_resource_extends.php @@ -90,7 +90,7 @@ class Smarty_Internal_Resource_Extends { foreach ($_files as $_filepath) { // read template file if ($_filepath === false) { - throw new Exception("Unable to load template 'file : {$_file}'"); + throw new SmartyException("Unable to load template 'file : {$_file}'"); } if ($_filepath != $_files[0]) { $_template->properties['file_dependency'][sha1($_filepath)] = array($_filepath, filemtime($_filepath)); diff --git a/libs/sysplugins/smarty_internal_resource_php.php b/libs/sysplugins/smarty_internal_resource_php.php index 93176c34..a2942222 100644 --- a/libs/sysplugins/smarty_internal_resource_php.php +++ b/libs/sysplugins/smarty_internal_resource_php.php @@ -102,10 +102,10 @@ class Smarty_Internal_Resource_PHP { public function renderUncompiled($_smarty_template) { if (!$this->smarty->allow_php_templates) { - throw new Exception("PHP templates are disabled"); + throw new SmartyException("PHP templates are disabled"); } if ($this->getTemplateFilepath($_smarty_template) === false) { - throw new Exception("Unable to load template \"{$_smarty_template->resource_type} : {$_smarty_template->resource_name}\""); + throw new SmartyException("Unable to load template \"{$_smarty_template->resource_type} : {$_smarty_template->resource_name}\""); } // prepare variables $_smarty_ptr = $_smarty_template; @@ -124,4 +124,4 @@ class Smarty_Internal_Resource_PHP { } } -?> +?> \ No newline at end of file diff --git a/libs/sysplugins/smarty_internal_security_handler.php b/libs/sysplugins/smarty_internal_security_handler.php index 1833d4f8..31fe47e5 100644 --- a/libs/sysplugins/smarty_internal_security_handler.php +++ b/libs/sysplugins/smarty_internal_security_handler.php @@ -75,7 +75,7 @@ class Smarty_Internal_Security_Handler { if (empty($this->smarty->security_policy->streams) || in_array($stream_name, $this->smarty->security_policy->streams)) { return true; } else { - throw new Exception ("stream '{$stream_name}' not allowed by security setting"); + throw new SmartyException ("stream '{$stream_name}' not allowed by security setting"); return false; } } @@ -112,7 +112,7 @@ class Smarty_Internal_Security_Handler { } } - throw new Exception ("directory '{$_rp}' not allowed by security setting"); + throw new SmartyException ("directory '{$_rp}' not allowed by security setting"); return false; } /** @@ -138,7 +138,7 @@ class Smarty_Internal_Security_Handler { } } - throw new Exception ("directory '{$_rp}' not allowed by security setting"); + throw new SmartyException ("directory '{$_rp}' not allowed by security setting"); return false; } } diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index d35aafbf..4786aa4c 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -98,7 +98,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { $this->template_resource = $template_resource; // parse resource name if (!$this->parseResourceName ($template_resource, $this->resource_type, $this->resource_name, $this->resource_object)) { - throw new Exception ("Unable to parse resource name \"{$template_resource}\""); + throw new SmartyException ("Unable to parse resource name \"{$template_resource}\""); } // load cache resource if (!$this->resource_object->isEvaluated && ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) { @@ -145,7 +145,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { { if ($this->template_source === null) { if (!$this->resource_object->getTemplateSource($this)) { - throw new Exception("Unable to read template {$this->resource_type} '{$this->resource_name}'"); + throw new SmartyException("Unable to read template {$this->resource_type} '{$this->resource_name}'"); } } return $this->template_source; @@ -164,7 +164,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { $this->isExisting = $this->resource_object->isExisting($this); } if (!$this->isExisting && $error) { - throw new Exception("Unable to load template {$this->resource_type} '{$this->resource_name}'"); + throw new SmartyException("Unable to load template {$this->resource_type} '{$this->resource_name}'"); } return $this->isExisting; } @@ -461,7 +461,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { ob_start(); $this->resource_object->renderUncompiled($this); } else { - throw new Exception("Resource '$this->resource_type' must have 'renderUncompiled' methode"); + throw new SmartyException("Resource '$this->resource_type' must have 'renderUncompiled' methode"); } } $this->rendered_content = ob_get_clean(); @@ -593,7 +593,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { // no tpl file found if (!empty($this->smarty->default_template_handler_func)) { if (!is_callable($this->smarty->default_template_handler_func)) { - throw new Exception("Default template handler not callable"); + throw new SmartyException("Default template handler not callable"); } else { $_return = call_user_func_array($this->smarty->default_template_handler_func, array($this->resource_type, $this->resource_name, &$this->template_source, &$this->template_timestamp, $this)); @@ -604,7 +604,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } } } - // throw new Exception("Unable to load template \"{$file}\""); return false; } @@ -729,7 +728,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } return new Smarty_Internal_Resource_Stream($this->smarty); } else { - throw new Exception('Unkown resource type \'' . $resource_type . '\''); + throw new SmartyException('Unkown resource type \'' . $resource_type . '\''); } } } @@ -883,7 +882,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { // convert camel case to underscored name $property_name = preg_replace_callback('/([A-Z])/', $camel_func, $property_name); if (!property_exists($this, $property_name)) { - throw new Exception("property '$property_name' does not exist."); + throw new SmartyException("property '$property_name' does not exist."); return false; } if ($first3 == 'get') diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index bd606fc9..c54dd8ab 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -183,7 +183,7 @@ class Smarty_Internal_TemplateCompilerBase { return $plugin_object->compile($args, $this); } } - throw new Exception("Plugin \"{$tag}\" not callable"); + throw new SmartyException("Plugin \"{$tag}\" not callable"); } else { if ($function = $this->getPlugin($tag, $plugin_type)) { return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $tag, $function); @@ -222,7 +222,7 @@ class Smarty_Internal_TemplateCompilerBase { return $plugin_object->compile($args, $this); } } - throw new Exception("Plugin \"{$tag}\" not callable"); + throw new SmartyException("Plugin \"{$tag}\" not callable"); } } $this->trigger_template_error ("unknown tag \"" . $tag . "\"", $this->lex->taglineno); @@ -400,7 +400,7 @@ class Smarty_Internal_TemplateCompilerBase { // output parser error message $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect); } - throw new Exception($error_text); + throw new SmartyCompilerException($error_text); } } diff --git a/libs/sysplugins/smarty_internal_wrapper.php b/libs/sysplugins/smarty_internal_wrapper.php index aa7bfb44..be6f4063 100644 --- a/libs/sysplugins/smarty_internal_wrapper.php +++ b/libs/sysplugins/smarty_internal_wrapper.php @@ -114,7 +114,7 @@ class Smarty_Internal_Wrapper { } $func_name = implode('',$name_parts); if(!method_exists($this->smarty,$func_name)) { - throw new Exception("unknown method '$name'"); + throw new SmartyException("unknown method '$name'"); return false; } return call_user_func_array(array($this->smarty,$func_name),$args); diff --git a/libs/sysplugins/smarty_internal_write_file.php b/libs/sysplugins/smarty_internal_write_file.php index 5c756f1b..a520a94d 100644 --- a/libs/sysplugins/smarty_internal_write_file.php +++ b/libs/sysplugins/smarty_internal_write_file.php @@ -31,7 +31,7 @@ class Smarty_Internal_Write_File { if (!file_put_contents($_tmp_file, $_contents)) { umask($old_umask); - throw new Exception("unable to write file {$_tmp_file}"); + throw new SmartyException("unable to write file {$_tmp_file}"); return false; } // remove original file @@ -46,4 +46,4 @@ class Smarty_Internal_Write_File { } } -?> +?> \ No newline at end of file