Edit report at https://bugs.php.net/bug.php?id=60879&edit=1
ID: 60879 Comment by: yoozer at gmail dot com Reported by: thijsputman at gmail dot com Summary: unserialize() Does not invoke __wakeup() on object Status: Closed Type: Bug Package: Class/Object related Operating System: Windows 7 PHP Version: 5.4.0RC6 Assigned To: johannes Block user comment: N Private report: N New Comment: I've just tested the official release of RC7; it still exhibits this issue with exactly the same testcase. Previous Comments: ------------------------------------------------------------------------ [2012-01-26 11:33:25] johan...@php.net So let's assume this was fixed. I can't see a relevant change for this, though. There will be another RC soon, an you check that, too, to be safe? Thanks :-) ------------------------------------------------------------------------ [2012-01-26 10:56:17] thijsputman at gmail dot com 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. ------------------------------------------------------------------------ [2012-01-26 10:14:20] johan...@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