Problem with unserialize

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
royalhunt
Forum Newbie
Posts: 10
Joined: Fri Sep 20, 2002 4:25 am
Location: Greece
Contact:

Problem with unserialize

Post 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
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

royalhunt
Forum Newbie
Posts: 10
Joined: Fri Sep 20, 2002 4:25 am
Location: Greece
Contact:

Thanx a lot...

Post by royalhunt »

Yeah that really worked. Thanx
Post Reply