PHP Serialization Will not work correctly.

Posted by stevoo on Stack Overflow See other posts from Stack Overflow or by stevoo
Published on 2010-12-29T12:51:42Z Indexed on 2010/12/29 12:53 UTC
Read the original article Hit count: 264

Filed under:
|
|

Hi,

I am developing and doing all the testing on a local machine using PHP Version 5.3.3-1ubuntu9.1 version.

The host machine is PHP Version 5.2.15.

All the seriliaze arguments are identical.

The problems is when i try to login the user on my test local machine i do the following :

$user->getByUserId($results['id'],$db); 
$_SESSION['user'] = serialize($user);

which retrieved me and serialize the user. and i just load it back when ever i detect that a session exists

$user->LoadFromObject(unserialize($_SESSION['user']));

This works perfectly on my test machine.

Just transfered the files on the host to see if i can get a beta version out but i keep on getting

Warning: unserialize() expects parameter 1 to be string, object given in /home/gamerent/public_html/beta/includes/header.php on line 19

i have noticed that if i echo the $_SESSION['user'] in both system the test will indeed display me the serializated one but the main one will just show me the object and will not serialize the $user

© Stack Overflow or respective owner

Related posts about php

Related posts about oop