0

Hi,

I get an error when i try to echo my cookie. Notice: unserialize() [function.unserialize]: Error at offset 0 of 12 bytes in... I cannot find a solution. Help please.

Thanks

class MyCookie {
  public function __construct($cookieName, $sessionId) {
    if(! isset($_COOKIE[$cookieName])) {
      $cookieValue["SESSION"] = $sessionId;
      setcookie($cookieName, $cookieValue, time()+60*60*24*7);
    }
  }
  public function fetchMe($cookieName) {
     $value = unserialize(stripslashes($cookieName));
     echo "<pre>";
     print_r($value);
  }
}

$mycookieObj=new MyCookie("myname", "testtest123");
$mycookieObj->fetchMe("myname");
1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by veledrom
0

Yes it must have been.

$value = unserialize(stripslashes($_COOKIE[$cookieName]));

solved

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.