I am having some trouble with storing a class in a session variable. 
According to the information in the manual, an object will be serialized 
at the end of each request and then unserialized at the beginning 
automatically. However, with this code:


session_register("objectvar", "stringvar");

if(isset($stringvar)) {
        echo "stringvar is set\n";
} else {
        $stringvar = "something";
        echo "stringvar is not set\n";

if(isset($objectvar)) {
        echo "objectvar is set\n";
} else {
        $objectvar = new MyObject;
        echo "objectvar is not set\n";


For the first page I will get:

stringvar is not set
objectvar is not set

And for each subsequent page:

stringvar is set
objectvar is not set

Is there something wrong with the way my code works? Is this a possible 
bug? I have had this problem with both 4.0.4pl1 (came with RH7.1) and 
with 4.0.6 (compiled myself). I've been struggling with this for 3 or 4 
days now and some help would be much appreciated.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to