From: Operating system: Windows 7 PHP version: 5.4.0RC6 Package: Class/Object related Bug Type: Bug Bug description:unserialize() Does not invoke __wakeup() on object
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 bug report at https://bugs.php.net/bug.php?id=60879&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60879&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60879&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60879&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60879&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60879&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60879&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60879&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60879&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60879&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60879&r=support Expected behavior: https://bugs.php.net/fix.php?id=60879&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60879&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60879&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60879&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60879&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60879&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60879&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60879&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60879&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60879&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60879&r=mysqlcfg