diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 47b89a8b..09c90363 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -464,7 +464,7 @@ class Smarty * * @var string */ - var $_version = '2.6.6-dev-2'; + var $_version = '2.6.6-dev-3'; /** * current template inclusion depth diff --git a/libs/internals/core.read_cache_file.php b/libs/internals/core.read_cache_file.php index 2ab42811..ecb14708 100644 --- a/libs/internals/core.read_cache_file.php +++ b/libs/internals/core.read_cache_file.php @@ -48,10 +48,11 @@ function smarty_core_read_cache_file(&$params, &$smarty) return false; } - $cache_split = explode("\n", $params['results'], 2); - $cache_header = $cache_split[0]; - - $_cache_info = unserialize($cache_header); + $_contents = $params['results']; + $_info_start = strpos($_contents, "\n") + 1; + $_info_len = (int)substr($_contents, 0, $_info_start - 1); + $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len)); + $params['results'] = substr($_contents, $_info_start + $_info_len); if ($smarty->caching == 2 && isset ($_cache_info['expires'])){ // caching by expiration time @@ -99,7 +100,6 @@ function smarty_core_read_cache_file(&$params, &$smarty) return false; } } - $params['results'] = $cache_split[1]; $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info); $smarty->_cache_info = $_cache_info; diff --git a/libs/internals/core.write_cache_file.php b/libs/internals/core.write_cache_file.php index d7a82849..72f785b7 100644 --- a/libs/internals/core.write_cache_file.php +++ b/libs/internals/core.write_cache_file.php @@ -62,7 +62,8 @@ function smarty_core_write_cache_file($params, &$smarty) $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials; // prepend the cache header info into cache file - $params['results'] = serialize($smarty->_cache_info)."\n".$params['results']; + $_cache_info = serialize($smarty->_cache_info); + $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results']; if (!empty($smarty->cache_handler_func)) { // use cache_handler function