Unserialize error Opencart

Please LogIn to Reply!

Post By: guest | 01-20-2013 07:57 Reply

Question

Hello everyone,
I've just finished installing this online shopping system.

However, I'm getting this error:


Notice: unserialize() [function.unserialize]: Error at offset 15 of 21016 bytes in C:xampphtdocswsnsystemlibrarycache.php on line 29

Notice: unserialize() [function.unserialize]: Error at offset 14 of 847 bytes in C:xampphtdocswsnsystemlibrarycache.php on line 29

Notice: unserialize() [function.unserialize]: Error at offset 15 of 18436 bytes in C:xampphtdocswsnsystemlibrarycache.php on line 29

Warning: Cannot modify header information - headers already sent by (output started at C:xampphtdocswsnsystemlibrarycache.php:29) in C:xampphtdocswsnsystemlibraryresponse.php on line 65


Could anyone please tell me what could be the problem? The installation was successful.

Thanks in advance.

Regards,
Soulfly

Answers

hello everyone,
Could anyone please tell me what's wrong?

Thanks in advance.

I installed open cart today and founda few errors which i am fixing, here's the solution.


system/library cache.php

Code: Select all
<?php
final class Cache {
   private $expire = 3600;

     public function __construct() {
      $files = glob(DIR_CACHE . 'cache.*');
       
      if ($files) {
         foreach ($files as $file) {
            $time = substr(strrchr($file, '.'), 1);

               if ($time < time()) {
               unlink($file);
               }
          }
      }
     }

   public function get($key) {
      $files = glob(DIR_CACHE . 'cache.' . $key . '.*');
      
      if ($files) {
          foreach ($files as $file) {
               $handle = fopen($file, 'r');
               $cache = fread($handle, filesize($file));
    
               fclose($handle);

               return $this->mb_unserialize($cache);
             }
      }
     }

     public function set($key, $value) {
       $this->delete($key);
      
      $file = DIR_CACHE . 'cache.' . $key . '.' . (time() + $this->expire);
       
      $handle = fopen($file, 'w');

       fwrite($handle, base64_encode(serialize($value)));
      
       fclose($handle);
     }
   
     public function delete($key) {
      $files = glob(DIR_CACHE . 'cache.' . $key . '.*');
      
      if ($files) {
          foreach ($files as $file) {
               unlink($file);
          }
      }
     }
   
   private function mb_unserialize($serial_str)
   {
      $out = preg_replace('!s:(d+):"(.*?)";!se', "'s:'.strlen('$2').':"$2";'", $serial_str );
      return unserialize(base64_decode($out));
   }
}
?>

Tags:

online unserialize

unserialize online

php unserialize online

Reply Or Comment!
Please LogIn to Reply!