I have an object, and I am using php’s session to persist the objects state. Here is basically what I’m doing:
I have “object A” which contains one “object B”. In the constructor for A, I am simply grabbing B from the session and setting “object B” equal to its appropriate value in the session.
I then proceed to call some of object b’s functions, but I have a feeling this may be wrong.
Do objects stored and retrieved from a php session retain their capabilities, or do they become data storage objects with no capabilities?
Cheers
Objects will be serialized before being placed in the session, thus they will be “fully fledged” when they are retrieved form the session due to de-serialization. Note that the object’s class needs to be available at the time of deserialization.
http://php.net/manual/en/language.oop5.serialization.php