on 7/31/01 1:48 PM, scott [gts] at [EMAIL PROTECTED] wrote:

> I am having a problem with __sleep();
> there mere existance of it is causing my object
> to not get serialized at all.  __wakeup() works fine.
> i am using PHP v4.0.6 / apache / win2k.
> If i keep __sleep() in the object, it will not serialize,
> but if i remove it, it serialized fine.  Does anyone
> know why this happens?

i asked this about a month ago and didn't hear anything. i too have never
been able to get __sleep to work. i think it's because i couldn't figure out
what needed to be returned (or how to return it :)

at http://www.php.net/manual/en/language.oop.magic-functions.php it says
that __sleep is "supposed to return an array with the names of all variables
of that object that should be serialized", but there are no examples of

in a current project, i have an object that is registed as a session
variable. it contains three objects and an array. one of the objects is a
PEAR db object, and i don't need to serialize it. i do want to maintain the
other two objects and the array.

i tried a number of ideas inside __sleep, to no avail. without __sleep, it
works. with __sleep, i break it.

i do use __wakeup to reinitialize my db object, but i just use
$db->disconnect(); at the end of my index file to disconnect .

does anyone know the proper way to "clean up the object" in __sleep and how
to return the variables that should be serialized? can this even be used
when one (or more) of the variables is an object itself?


 -- mike cullerton

PHP General Mailing List (http://www.php.net/)
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