The way we do commonly this in Dreamtime is to have a container object
(essentially an associative array with a wrapper
( that allows
you to get/set the profile data elements by name.

That whole object is then serialized as the (single) session data element.

However, in a pinch I think that unserialize() could probably tolerate some
deviation in the class definition.  You could probably add/delete methods
without any problem, since methods aren't serialized.

I haven't tried to see what would happen if the list of variables of the
serialized object didn't match the subsequent class, but I'm guessing that
PHP is pretty forgiving.  It would only take a few moments to try this out.

- Tim

----- Original Message -----
From: "Michael Champagne" <[EMAIL PROTECTED]>
To: "PHP General Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, July 09, 2001 10:58 AM
Subject: [PHP] Storing serialized classes in database

> We are writing a series of applications which will store a user 'profile'
> between sessions as a serialized object in our Oracle database.  We're
> data like the output format a user prefers file downloads in and things
> that.  If have to add certain things to this class, I'm assuming the
> serialized objects in the database become unusable.  Does anyone have a
> solution for this?  I suppose we could go through the database and somehow
> convert these serialized 'profiles' to meet the new class spec.  How much
of a
> hassle is that?

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to