Smarty 2.3.0 debug console bug and patch
| From: | Konstantin | Date: | Fri, 20 Sep 2002 16:07:31 +0000 |
| Subject: | Smarty 2.3.0 debug console bug and patch | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-276@lists.php.net to get a copy of this message | ||
Hi!
The following bug in Smarty 2.3.0 debug console happens if:
1. error reporting is E_ALL
2. I use fetch()
In this case
_smarty_debug_info[$included_tpls_idx]['exec_time']
becomes not set and I got warning about this, so JavaScript part of debug.tpl isn't showed at
all.
Possible patch is in attachment
diff -aur Smarty-2.3.0/Smarty.class.php Smarty/Smarty.class.php --- Smarty-2.3.0/Smarty.class.php Wed Aug 7 18:57:33 2002 +++ Smarty/Smarty.class.php Fri Sep 20 18:46:28 2002 @@ -634,12 +634,14 @@ $this->_load_plugins($this->_cache_info['insert_tags']); $_smarty_results = $this->_process_cached_inserts($_smarty_results); } + if ($this->debugging) + { + // capture time for debugging info + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = $this->_get_microtime() - $debug_start_time; + } if ($_smarty_display) { if ($this->debugging) { - // capture time for debugging info - $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = $this->_get_microtime() - $debug_start_time; - $_smarty_results .= $this->_generate_debug_output(); } if ($this->cache_modified_check) { @@ -704,12 +706,14 @@ $_smarty_results = $this->_process_cached_inserts($_smarty_results); } + if ($this->debugging) { + // capture time for debugging info + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = ($this->_get_microtime() - $debug_start_time); + } + if ($_smarty_display) { if (isset($_smarty_results)) { echo $_smarty_results; } if ($this->debugging) { - // capture time for debugging info - $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = ($this->_get_microtime() - $debug_start_time); - echo $this->_generate_debug_output(); } error_reporting($_smarty_old_error_level);
diff -aur Smarty-2.3.0/Smarty.class.php Smarty/Smarty.class.php --- Smarty-2.3.0/Smarty.class.php Wed Aug 7 18:57:33 2002 +++ Smarty/Smarty.class.php Fri Sep 20 18:46:28 2002 @@ -634,12 +634,14 @@ $this->_load_plugins($this->_cache_info['insert_tags']); $_smarty_results = $this->_process_cached_inserts($_smarty_results); } + if ($this->debugging) + { + // capture time for debugging info + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = $this->_get_microtime() - $debug_start_time; + } if ($_smarty_display) { if ($this->debugging) { - // capture time for debugging info - $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = $this->_get_microtime() - $debug_start_time; - $_smarty_results .= $this->_generate_debug_output(); } if ($this->cache_modified_check) { @@ -704,12 +706,14 @@ $_smarty_results = $this->_process_cached_inserts($_smarty_results); } + if ($this->debugging) { + // capture time for debugging info + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = ($this->_get_microtime() - $debug_start_time); + } + if ($_smarty_display) { if (isset($_smarty_results)) { echo $_smarty_results; } if ($this->debugging) { - // capture time for debugging info - $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = ($this->_get_microtime() - $debug_start_time); - echo $this->_generate_debug_output(); } error_reporting($_smarty_old_error_level);