php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48388 ArrayObject and __sleep()
Submitted: 2009-05-25 15:49 UTC Modified: 2010-05-18 16:25 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:3 (75.0%)
From: david at grudl dot com Assigned: colder (profile)
Status: Closed Package: SPL related
PHP Version: 5.2.9 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:49 UTC] david at grudl dot com
Description:
------------
ArrayObject descendants can be forced to serialize public/protected/private properies using __sleep(), but it produces E_NOTICE



Reproduce code:
---------------
class Test extends ArrayObject
{
	public $var = 123;

	public function __sleep()
	{
		return array('var');
	}
}

$test = new Test;
$s = serialize($test);


Expected result:
----------------
none

Actual result:
--------------
Notice: serialize() [function.serialize]: "var" returned as member variable from __sleep() but does not exist

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-18 16:25 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2010-05-18 16:25 UTC] mike@php.net
Fixed in 5.3.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC