What does "PHP_Incomplete_Class" mean?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a class "Form" that I instantiate then put in the SESSION in
order to use it on another page. When I get to the new page, I can't
access any of the fields of the class because they're all NULL. The
weird thing is, in my debugger $_SESSION['myFormInstance'] shows as
having fields not null -- they are filled with the appropriate values.
But when I do

$foo = $_SESSION['myFormInstance'];


$foo->someField is NULL.

Also, in the listing of SESSION variables in the debugger, under "Type"
myFormInstance has a type of "object(__PHP_Incomplete_Class)".

Any insight into this would be greatly appreciated.



Re: What does "PHP_Incomplete_Class" mean?

Quoted text here. Click to load it

OK, I'll ask the obvious:  Do you have session_start() right at the top?


Re: What does "PHP_Incomplete_Class" mean?

Shelly wrote:
Quoted text here. Click to load it



Re: What does "PHP_Incomplete_Class" mean?

elektrophyte wrote:
Quoted text here. Click to load it

I found out the answer. It's that the class declaration has to be
available before you call session_start(). If your class is defined in
an included file, you have to call include() (include_once(),
require(), require_once()) before you call session_start().


Site Timeline