Page 1 of 1

Problem with unserialize

Posted: Tue Sep 24, 2002 3:33 am
by royalhunt
I have serialized an object and "added" it in a cookie. when i try to unserialize the object to a variable and call the gettype function i get as output "boolean". This is the code for unserialize:

Code: Select all

$connection = $HTTP_COOKIE_VARSї'login'];
$oracle = unserialize($connection);
echo gettype($connection)."<BR>".gettype($oracle);
the output is:
string
boolean

The code for serializing the object is the following:

Code: Select all

$connection = serialize($oracle);
if (setcookie("login", $connection))&#123;
  header("Location: search.php");
&#125;
What is wrong with unserialize? I saw the manual of php and it didn't mention that returns a boolean!!!!!!! And why should return a boolean in the first placE?!?!?!?!?! Please help me with that

Posted: Tue Sep 24, 2002 3:46 am
by Coco

Thanx a lot...

Posted: Tue Sep 24, 2002 3:56 am
by royalhunt
Yeah that really worked. Thanx