Merge pull request #2559 from willmorgan/cachetofile-arguments

Making cacheToFile  key more resilient against mixed/nested types
This commit is contained in:
Ingo Schommer 2013-10-18 07:22:06 -07:00
commit 337a29abce

View File

@ -1066,7 +1066,7 @@ abstract class Object {
if(!is_array($arguments)) $arguments = array($arguments);
if($ID) $cacheName .= '_' . $ID;
if(count($arguments)) $cacheName .= '_' . implode('_', $arguments);
if(count($arguments)) $cacheName .= '_' . md5(serialize($arguments));
if($data = $this->loadCache($cacheName, $lifetime)) {
return $data;
@ -1085,7 +1085,7 @@ abstract class Object {
$cacheName = $this->class . '_' . $method;
if(!is_array($arguments)) $arguments = array($arguments);
if($ID) $cacheName .= '_' . $ID;
if(count($arguments)) $cacheName .= '_' . implode('_', $arguments);
if(count($arguments)) $cacheName .= '_' . md5(serialize($arguments));
$file = TEMP_FOLDER . '/' . $this->sanitiseCachename($cacheName);
if(file_exists($file)) unlink($file);