Jack
Jack

Reputation: 97

Any reason to serialize an object stored in a session variable?

Is there any reason to serialize an object stored in a $_SESSION variable?

Upvotes: 1

Views: 127

Answers (2)

deceze
deceze

Reputation: 522195

If your session is auto-started, you have to resort to pretty ugly hacks to load the class definitions beforehand so the object can be properly unserialized. In this case, unserializing by hand is preferable. Of course, in this case, not auto-starting the session is even more preferable.

Upvotes: 2

Petah
Petah

Reputation: 46040

No, it happens automatically when you save the session anyway.

Upvotes: 2

Related Questions