From d2cafef753cfacc8e10070d0a0d61ce6ed7d0469 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Sun, 14 Nov 2010 18:46:18 +0000 Subject: [PATCH] - small performace patch in Smarty class --- change_log.txt | 1 + libs/Smarty.class.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 2875a1a4..d6491979 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,6 +2,7 @@ - bugfix isset() did not allow multiple parameter - improvment of some error messages - bugfix html_image did use removed property $request_use_auto_globals +- small performace patch in Smarty class 13/11/2010 - bugfix overloading problem when $smarty->fetch()/display() have been used in plugins diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index abd6ea0a..06fee411 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -305,7 +305,7 @@ class Smarty extends Smarty_Internal_Data { */ public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false) { - if (is_object($cache_id)) { + if (!empty($cache_id) && is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } @@ -422,11 +422,11 @@ class Smarty extends Smarty_Internal_Data { */ public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) { - if (is_object($cache_id) || is_array($cache_id)) { + if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) { $parent = $cache_id; $cache_id = null; } - if (is_array($parent)) { + if (!empty($parent) && is_array($parent)) { $data = $parent; $parent = null; } else { @@ -448,7 +448,7 @@ class Smarty extends Smarty_Internal_Data { $tpl = $template; } // fill data if present - if (is_array($data)) { + if (!empty($data) && is_array($data)) { // set up variable values foreach ($data as $_key => $_val) { $tpl->tpl_vars[$_key] = new Smarty_variable($_val);