ID:               17436
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Critical
 Bug Type:         Session related
 Operating System: MacOS X 10.1.4
 PHP Version:      4.2.1
 New Comment:

Reproduced here on OS X. mod_files can write the session 
files ok, but doesn't seem to be able to read them. Digging 
into this.


Previous Comments:
------------------------------------------------------------------------

[2002-05-26 13:49:25] [EMAIL PROTECTED]

I have not been able to get objects to "come back to life" 
since version 4.1. I have read (and understand) all the new 
superglobals and security issues, and I am convinced it is 
not that (although for a while I was blaming my 
misunderstanding). The message php returns is that the 
class is not defined-- but it is.

The following code shows the problem. You can see that 
regular variables come back on the session page, but the 
simple object just causes an error. 

Here is the output:

------

Session variable set.
Session message made it: Variable made it.
Fatal error: The script tried to execute a method or access 
a property of an incomplete object. Please ensure that the 
class definition test_class of the object you are trying to 
operate on was loaded _before_ the session was started in /
Users/ndp/Sites/php/session_test.php on line 27

-----

Here is the source code named session_test.php:

-----

<?

class test_class
{
        var $m;
        
        function test_class()
        {
                $this->m = "";
        }
        
        function set_m($in_m)
        {
                $this->m = $in_m;
        }
        
        function get_m()
        {
                return $this->m;
        }
}

if (isset($_SESSION["m"]))
{
        print "Session variable set.<br />";
        print "Session message made it: ".$_SESSION["message"]."<
br />";
        print "Value = ".$_SESSION["m"]->get_m()."<br />";
}
else
{
        session_start();
        
        $_SESSION["message"] = "Variable made it.";
        $_SESSION["m"] = new test_class();
        $_SESSION["m"]->set_m("YES");
}


?>

<form action=session_test.php method=get>
        <input type=submit>
<form>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17436&edit=1

Reply via email to