#41528 [Opn->Asn]: Classes extending ArrayObject do not serialize correctly

From: Date: Tue, 29 May 2007 10:54:39 +0000
Subject: #41528 [Opn->Asn]: Classes extending ArrayObject do not serialize correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113149@lists.php.net to get a copy of this message
ID: 41528 Updated by: tony2001@php.net Reported By: m dot stach at ewerk dot com -Status: Open +Status: Assigned Bug Type: SPL related Operating System: All PHP Version: 5.2.2 -Assigned To: +Assigned To: helly Previous Comments: ------------------------------------------------------------------------ [2007-05-29 10:48:09] m dot stach at ewerk dot com Description: ------------ If a class extends ArrayObject, serializing does not work correctly. All properties are missing after unserializing, only the array contents are remain. ArrayObjects (un)serializes without problems and does not implement the Serializable interface, so there seems no need to change the implementation of that interface. The documentation mentions that it is not possible to serialize objects of internal class. Since ArrayObject itself serializes fine, I regard ArrayObject as "non-internal". May be this is a documentation bug. But this would IMHO limit the broad use of the ArrayObject class. Reproduce code: --------------- class a extends ArrayObject { public $a = 2; } $a = new a(); $a->a = 1; var_dump($a); var_dump($a->a); $a = unserialize(serialize($a)); var_dump($a); var_dump($a->a); Expected result: ---------------- object(a)#1 (1) { ["a"]=> int(1) } int(1) object(a)#1 (1) { ["a"]=> int(1) } int(1) Actual result: -------------- object(a)#1 (0) { } int(1) object(a)#2 (0) { } int(2) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41528&edit=1

« previous php.bugs (#113149) next »