Bug #12793 Updated: __sleep causing problems
| From: | flying at dom dot natm dot ru | Date: | Wed, 06 Mar 2002 12:14:59 +0000 |
| Subject: | Bug #12793 Updated: __sleep causing problems | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-1765@lists.php.net to get a copy of this message | ||
ID: 12793
Updated by: flying@dom.natm.ru
Reported By: clownfighter@hotmail.com
Status: Closed
Bug Type: Session related
PHP Version: 4.0.6
New Comment:
Confirm this bug on PHP 4.0.6 and 4.1.1 on Windows 2000 Server and
Apache 1.3.23
Here is requested testcase:
<?php
class myClass
{
function myClass()
{
}
function __sleep()
{
echo 'sleep!<br>';
}
function __wakeup()
{
echo 'wakeup!<br>';
}
};
$obj = new myClass();
$str = serialize($obj);
echo $str."<br>";
$obj2 = unserialize($str);
print_r($obj2);
?>
Running this script on PHP 4.0.6 will set $str to empty string
(however __sleep() is called properly). Commenting out __sleep() method
will return normal serialized value of an object.
Running this script on PHP 4.1.1 cause PHP to crash.
Please reopen this bug or i'll submit new one :)
Previous Comments:
------------------------------------------------------------------------
[2001-12-26 18:51:58] lobbin@php.net
No feedback. Closing.
------------------------------------------------------------------------
[2001-12-05 10:19:18] sander@php.net
Can you provide a _simple_ sample-script?
------------------------------------------------------------------------
[2001-08-16 10:28:56] clownfighter@hotmail.com
When I create a db connection object, call it "conn", with a __sleep
function to close the connection when the object is serialized for a
session, any object which has an instance of "conn" fails to load
properly. For instance, if I have an object "permissions" that has a
"conn" object, when I unserialize "permissions" from a session the
class appears to never be defined. I don't get any error messages until
I try to use "permissions," in which case it says "Call to a function
of a non-object" whenever I try to use a function of "permissions."
Never do I get an error from "conn" or "permissions."
Comment out the __sleep function in "conn" and things work fine.
My configure line:
'./configure' '--with-postgres' '--with-gd' '--with-pspell'
'--with-apxs'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12793&edit=1