cvs: smarty /libs Smarty.class.php /libs/internals core.read_cache_file.php core.write_cache_file.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1107253148@cvsserver> |
messju Tue Feb 1 05:19:08 2005 EDT
Modified files:
/smarty/libs Smarty.class.php
/smarty/libs/internals core.read_cache_file.php
core.write_cache_file.php
Log:
fixed serialization of values containing newlines (like _cache_attrs)
in core_write_cache_file()
bumped version to 2.6.6-dev-3 to indicate that the fileformat of cache
has changed
http://cvs.php.net/diff.php/smarty/libs/Smarty.class.php?r1=1.509&r2=1.510&ty=u
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.509 smarty/libs/Smarty.class.php:1.510
--- smarty/libs/Smarty.class.php:1.509 Sun Jan 23 17:19:15 2005
+++ smarty/libs/Smarty.class.php Tue Feb 1 05:19:08 2005
@@ -30,7 +30,7 @@
* @version 2.6.6-dev
*/
-/* $Id: Smarty.class.php,v 1.509 2005/01/23 22:19:15 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.510 2005/02/01 10:19:08 messju Exp $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -464,7 +464,7 @@
*
* @var string
*/
- var $_version = '2.6.6-dev-2';
+ var $_version = '2.6.6-dev-3';
/**
* current template inclusion depth
http://cvs.php.net/diff.php/smarty/libs/internals/core.read_cache_file.php?r1=1.1&r2=1.2&ty=u
Index: smarty/libs/internals/core.read_cache_file.php
diff -u smarty/libs/internals/core.read_cache_file.php:1.1 smarty/libs/internals/core.read_cache_file.php:1.2
--- smarty/libs/internals/core.read_cache_file.php:1.1 Thu Sep 16 19:07:32 2004
+++ smarty/libs/internals/core.read_cache_file.php Tue Feb 1 05:19:08 2005
@@ -48,10 +48,11 @@
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 @@
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;
http://cvs.php.net/diff.php/smarty/libs/internals/core.write_cache_file.php?r1=1.3&r2=1.4&ty=u
Index: smarty/libs/internals/core.write_cache_file.php
diff -u smarty/libs/internals/core.write_cache_file.php:1.3 smarty/libs/internals/core.write_cache_file.php:1.4
--- smarty/libs/internals/core.write_cache_file.php:1.3 Sat Oct 2 14:03:25 2004
+++ smarty/libs/internals/core.write_cache_file.php Tue Feb 1 05:19:08 2005
@@ -62,7 +62,8 @@
$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
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php