php-general | 2001072
Date: 07/31/01
- Next message: Mitch Vincent: "[PHP] If Failing - Very strange"
- Previous message: JR: "RE: [PHP] FAQ - was "Attitude of B van Ouwerkerk""
- Next in thread: mike cullerton: "Re: [PHP] issues with __sleep() and __wakeup()"
- Reply: mike cullerton: "Re: [PHP] issues with __sleep() and __wakeup()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
Here's my object:
class Scott {
var $svar = array(); // free-form hash for whatever data
function Scott( )
{
return $this;
}
function __sleep()
{
}
function __wakeup()
{
$this->svar['sleep'] = "I am waking up";
}
}// end class
and now a test script
require_once('class.Scott.php');
$scott = new Scott();
$scott->svar['blah'] = "bacon";
print "object = ". $scott ."\n";
print "blah = ". $scott->svar['blah'] ."\n";
print "\n";
// serialize
$ser = serialize($scott);
print "serialized = ". $ser ."\n";
// trash the object
unset($scott);
print "unset object = ". $scott ."\n\n";
// unserialize
$scott = unserialize($ser);
print "object = ". $scott ."\n";
print "blah = ". $scott->svar['blah'] ."\n";
print "sleep = ". $scott->svar['sleep'] ."\n";
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Mitch Vincent: "[PHP] If Failing - Very strange"
- Previous message: JR: "RE: [PHP] FAQ - was "Attitude of B van Ouwerkerk""
- Next in thread: mike cullerton: "Re: [PHP] issues with __sleep() and __wakeup()"
- Reply: mike cullerton: "Re: [PHP] issues with __sleep() and __wakeup()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

