Edit report at https://bugs.php.net/bug.php?id=60879&edit=1

 ID:                 60879
 Updated by:         johan...@php.net
 Reported by:        thijsputman at gmail dot com
 Summary:            unserialize() Does not invoke __wakeup() on object
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Windows 7
 PHP Version:        5.4.0RC6
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Works for me with latest svn. Do you have any special extension loaded or some 
special configuration?


Previous Comments:
------------------------------------------------------------------------
[2012-01-25 13:24:57] thijsputman at gmail dot com

Description:
------------
When serializing/unserializing an object that contains both a __sleep() and 
__wakeup() method, serialize() invokes the __sleep() method, but unserialize() 
does *not* invoke the __wakeup() method.

Using PHP 5.4.0RC6 (x86 NTS) on Windows 7, previously used 5.4.0RC5 which did 
not exhibit this problem. See the below test script for an example (which works 
as expected in RC5, but not in RC6).

Test script:
---------------
class Woei{

        public function __sleep(){

                echo 'sleep' . PHP_EOL;

                return array();
        }

        public function __wakeup(){

                echo 'wakeup' . PHP_EOL;
        }
}

$Woei = new Woei();

$s1 = serialize($Woei);
$Woei2 = unserialize($s1);

$s2 = serialize($Woei2);
$Woei3 = unserialize($s2);

Expected result:
----------------
sleep
wakeup
sleep
wakeup

Actual result:
--------------
sleep
sleep


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60879&edit=1

Reply via email to