redmeteoric Posted April 19, 2014 Share Posted April 19, 2014 Sometimes i get this error massage in my prestashop 1.5.6 Notice: unserialize() [function.unserialize]: Unexpected end of serialized data in ...../public_html/classes/cache/CacheFs.php on line 40 In here is my cachefs.php file (line 40 red mark): <?php /* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class CacheFsCore extends Cache { /** * @var int Number of subfolders to dispatch cached filenames */ protected $depth; protected function __construct() { $this->depth = Db::getInstance()->getValue('SELECT value FROM '._DB_PREFIX_.'configuration WHERE name= \'PS_CACHEFS_DIRECTORY_DEPTH\'', false); $keys_filename = $this->getFilename(self::KEYS_NAME); if (file_exists($keys_filename)) $this->keys = unserialize(file_get_contents($keys_filename)); } /** * @see Cache::_set() */ protected function _set($key, $value, $ttl = 0) { return (@file_put_contents($this->getFilename($key), serialize($value))); } /** * @see Cache::_get() */ protected function _get($key) { if ($this->keys[$key] > 0 && $this->keys[$key] < time()) { $this->delete($key); return false; } $filename = $this->getFilename($key); if (!file_exists($filename)) { unset($this->keys[$key]); $this->_writeKeys(); return false; } $file = file_get_contents($filename); return unserialize($file); } /** * @see Cache::_exists() */ protected function _exists($key) { if ($this->keys[$key] > 0 && $this->keys[$key] < time()) { $this->delete($key); return false; } return isset($this->keys[$key]) && file_exists($this->getFilename($key)); } /** * @see Cache::_delete() */ protected function _delete($key) { $filename = $this->getFilename($key); if (!file_exists($filename)) return true; return unlink($filename); } /** * @see Cache::_writeKeys() */ protected function _writeKeys() { @file_put_contents($this->getFilename(self::KEYS_NAME), serialize($this->keys)); } /** * @see Cache::flush() */ public function flush() { $this->delete('*'); return true; } /** * Delete cache directory */ public static function deleteCacheDirectory() { Tools::deleteDirectory(_PS_CACHEFS_DIRECTORY_, false); } /** * Create cache directory * * @param int $level_depth * @param string $directory */ public static function createCacheDirectories($level_depth, $directory = false) { if (!$directory) $directory = _PS_CACHEFS_DIRECTORY_; $chars = '0123456789abcdef'; for ($i = 0, $length = strlen($chars); $i < $length; $i++) { $new_dir = $directory.$chars[$i].'/'; if (mkdir($new_dir)) if (chmod($new_dir, 0777)) if ($level_depth - 1 > 0) CacheFs::createCacheDirectories($level_depth - 1, $new_dir); } } /** * Transform a key into its absolute path * * @param string $key * @return string */ protected function getFilename($key) { $key = md5($key); $path = _PS_CACHEFS_DIRECTORY_; for ($i = 0; $i < $this->depth; $i++) $path .= $key[$i].'/'; return $path.$key; } } Any one can solve this? Thanks Link to comment Share on other sites More sharing options...
NemoPS Posted April 19, 2014 Share Posted April 19, 2014 On which page are you getting this error? Link to comment Share on other sites More sharing options...
redmeteoric Posted April 19, 2014 Author Share Posted April 19, 2014 It's random sometimes either in BO or Front office. When i click refresh, the massage will disappear. Link to comment Share on other sites More sharing options...
redmeteoric Posted April 20, 2014 Author Share Posted April 20, 2014 (edited) usually i get this massage when i 'clear smarty cache" Notice: unserialize() [function.unserialize]: Error at offset 16365 of 16384 bytes in ****/public_html/classes/cache/CacheFs.php on line 40 Warning: Cannot modify header information - headers already sent by (output started at ***/public_html/classes/cache/CacheFs.php:40) in ****/public_html/classes/Tools.php on line 141 then i click refresh and back to normal. Any one know what just happened? Edited April 20, 2014 by redmeteoric (see edit history) Link to comment Share on other sites More sharing options...
nosnosnos Posted May 6, 2014 Share Posted May 6, 2014 usually i get this massage when i 'clear smarty cache" then i click refresh and back to normal. Any one know what just happened? I have same random error: Notice: unserialize() [function.unserialize]: Error at offset 12283 of 12288 bytes in /home/proto/public_html/classes/cache/CacheFs.php on line 40 Warning: Cannot modify header information - headers already sent by (output started at /home/proto/public_html/classes/cache/CacheFs.php:40) in /home/proto/public_html/classes/controller/FrontController.php on line 790 Let me know if you solve this problem i have 1.6.0.6 last version Thanks Tiz Link to comment Share on other sites More sharing options...
abbel Posted June 22, 2016 Share Posted June 22, 2016 You have probabily to disable xcache Link to comment Share on other sites More sharing options...
Recommended Posts