Jason Giangrande wrote:
I'm having a problem unserializing objects that are passed from page to page with sessions. Registered globals is disabled so I am using the $_SESSION array to store session variable and am not using session_register(). Here's what I'm doing.

On first page:

$auth = new Class();
session_start();
$_SESSION['auth'] = serialize($auth);

Second page:

session_start();
var_dump($_SESSION);
$auth = unserialize($_SESSION['auth']);
var_dump($auth);

When I var_dump() $_SESSION it appears to be a string representation of the object. However, when I try to unserialize() it and store it in $auth the value is bool(false) and not an object.

Can anyone tell me what I am doing wrong?

Don't I feel stupid now. I have solved my problem. I had written a __sleep() function that I had forgotten about, and as it turns out, it was breaking things. Not really sure why. It was just creating the array of object properties to be serialized. Commenting it out fixes the problem I was having.


--
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to