Edit report at https://bugs.php.net/bug.php?id=60879&edit=1
ID: 60879
User updated by: thijsputman at gmail dot com
Reported by: thijsputman at gmail dot com
Summary: unserialize() Does not invoke __wakeup() on object
-Status: Feedback
+Status: Open
Type: Bug
Package: Class/Object related
Operating System: Windows 7
PHP Version: 5.4.0RC6
Block user comment: N
Private report: N
New Comment:
Just tried with revision 322785 and it indeed works as expected.
To assert my sanity I re-downloaded 5.4.0RC6 (VC9 x86 Non Thread Safe, 2012-Jan-19 23:40:07) from
the QA website and in that release the problem does exist.
Previous Comments:
------------------------------------------------------------------------
[2012-01-26 10:14:20] johannes@php.net
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?
------------------------------------------------------------------------
[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