Bug #60879 [Opn->Csd]: unserialize() Does not invoke __wakeup() on object

From: Date: Thu, 26 Jan 2012 11:33:25 +0000
Subject: Bug #60879 [Opn->Csd]: unserialize() Does not invoke __wakeup() on object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-166814@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60879&edit=1

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

 New Comment:

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 :-)


Previous Comments:
------------------------------------------------------------------------
[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] 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


Thread (14 messages)

« previous php.bugs (#166814) next »