bug with config_load and caching

From: Date: Sat, 08 Mar 2003 03:25:55 +0000
Subject: bug with config_load and caching
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8487@lists.php.net to get a copy of this message
Hello... There is a bug if you use the function "$smarty->config_load()" and have enabled caching. The name of the template file is NOT written in the cache file meta line (the first line). simple example: ---index.tpl--- foobar ---index.php--- $smarty = new Smarty; $smarty->caching = true; $smarty->config_load('test.conf'); //doesn't matter which file, but it should exist ;) $smarty->display('index.tpl'); the resulting line in cache file: a:3:{s:6:"config";a:1:{i:0;s:9:"test.conf";}s:9:"timestamp";i:1047001755;s:7 :"expires";i:1047005355;} As you can see there is no "template"-key. I think the bug is in 'smarty.class.php' function 'fetch()': line 1100: $this->_cache_info is saved in $_cache_info and unset after that (because of the "config_load()" the array was not empty) line 1136: $this->_cache_info['template'][] = $_smarty_tpl_file; (the template name is set here correctly) line 1143: $this->_cache_info is restored from $_cache_info !!!THIS IS THE BUG!!! Appending here (line 1143+) a if (!isset($_cache_info['template'])) $this->_cache_info['template'][] = $_smarty_tpl_file; could/should correct the problem, but I'm not sure. Maybe there are some side effects. Bye... Nagger

« previous php.smarty.general (#8487) next »