|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-01 12:14 UTC] markonen@php.net
[2002-06-01 12:32 UTC] markonen@php.net
[2002-06-19 05:44 UTC] twocandles3000 at hotmail dot com
[2002-06-20 14:10 UTC] ndp at mac dot com
[2002-09-16 14:55 UTC] derick@php.net
[2003-03-26 00:58 UTC] rasmus@php.net
[2003-04-26 18:26 UTC] iain at lexingtonwarner dot com
[2003-06-30 12:54 UTC] developer at yecc dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
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>