Michael B Allen wrote:
Well I figured out what the problem was. I was putting an 'Auth'
object in the session. I made some changes to something that
invalidated the class definition of that object. As soon as I logged
out the Auth object in the session was reinstantiated and the error
went away. No big deal.
It seems you must require_once the class of the object stored in the session
before
calling session_start. I guess session_start is deserializing things
and if the class definition isn't available it defaults to an
incomplete type.
The problem has to do with serializing/unserializing objects (which
sessions do in the background).
When you serialize an entire class, it only saves the classes
properties, not the methods within. (open up a serialized object file to
see what i mean). When you unserialize it, you'll be creating a
variable with all the properties of a class. If you've defined that
class (in your case, by requiring the class file before unserializing
it), it will instantiate the class and fill in the proper properties and
then put it into your variable. Otherwise it will create an
'incomplete' class that only has the same name and all the saved
properties, but no methods.
Here's some other info on the subject as well
http://www.php.net/manual/en/language.oop.serialization.php
Mark Armendariz
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php