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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC