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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 00:01:35 2025 UTC