From 0ce1799133a72ea5ae2e275b9355f3c4b554127a Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 5 Feb 2003 22:19:16 +0000 Subject: [PATCH] fix problem with inserts and nested fetches --- NEWS | 2 ++ Smarty.class.php | 10 +++++++++- libs/Smarty.class.php | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4f5123a2..5c255be4 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - fix problem with inserts and nested fetches + (Rainer Collet, Monte) - added support for passing params to include_php (Tim Riley, Monte) - added support for math operators in if statements (Monte) diff --git a/Smarty.class.php b/Smarty.class.php index be857692..a3102f62 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -1052,6 +1052,11 @@ class Smarty $this->_inclusion_depth = 0; if ($this->caching) { + if(!empty($this->_cache_info)) { + // nested call, init cache_info + $_cache_info = $this->_cache_info; + $this->_cache_info = array(); + } if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if (@count($this->_cache_info['insert_tags'])) { $this->_load_plugins($this->_cache_info['insert_tags']); @@ -1085,9 +1090,12 @@ class Smarty return $_smarty_results; } } else { - $this->_cache_info = array(); $this->_cache_info['template'][] = $_smarty_tpl_file; } + if(isset($_cache_info)) { + // restore cache_info + $this->_cache_info = $_cache_info; + } } if (count($this->autoload_filters)) { diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index be857692..a3102f62 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1052,6 +1052,11 @@ class Smarty $this->_inclusion_depth = 0; if ($this->caching) { + if(!empty($this->_cache_info)) { + // nested call, init cache_info + $_cache_info = $this->_cache_info; + $this->_cache_info = array(); + } if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if (@count($this->_cache_info['insert_tags'])) { $this->_load_plugins($this->_cache_info['insert_tags']); @@ -1085,9 +1090,12 @@ class Smarty return $_smarty_results; } } else { - $this->_cache_info = array(); $this->_cache_info['template'][] = $_smarty_tpl_file; } + if(isset($_cache_info)) { + // restore cache_info + $this->_cache_info = $_cache_info; + } } if (count($this->autoload_filters)) {