php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48386 ArrayObject and __wakeup()
Submitted: 2009-05-25 15:31 UTC Modified: 2010-05-18 15:41 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 3 (66.7%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: david at grudl dot com Assigned: colder (profile)
Status: Not a bug Package: SPL related
PHP Version: 5.3CVS-2009-05-25 (snap) OS: *
Private report: No CVE-ID: None
 [2009-05-25 15:31 UTC] david at grudl dot com
Description:
------------
Unserialization of ArrayObject descendants doesn't call __wakeup in PHP 5.3.

Reproduce code:
---------------
class Test extends ArrayObject
{

	public function __wakeup()
	{
		echo 'hey';
	}

}

$test = new Test;
$dolly = unserialize(serialize($test));

Expected result:
----------------
-> hey

Actual result:
--------------
none

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-18 15:41 UTC] mike@php.net
-Status: Assigned +Status: Bogus
 [2010-05-18 15:41 UTC] mike@php.net
For classes implementing the Serializable interface, $obj->unserialize($serializedData) is called instead of __wakeup():

class Test extends ArrayObject {
  function unserialize($serialized) {
    echo "Hey!\n";
    return parent::unserialize($serialized);
  }
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 15:01:29 2024 UTC