Bug #67369 [Ver->Csd]: ArrayObject serialization drops the iterator class
Edit report at https://bugs.php.net/bug.php?id=67369&edit=1
ID: 67369
Updated by: nikic@php.net
Reported by: kmiller68 at gmail dot com
Summary: ArrayObject serialization drops the iterator class
-Status: Verified
+Status: Closed
Type: Bug
Package: SPL related
Operating System: OSX/Unix
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of alexinbeijing@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0d11d373574a7f831db6e3a7add60f2bbe28413f
Log: Fix bug #67369 ArrayObject serializatino drops the iterator class
Previous Comments:
------------------------------------------------------------------------
[2015-08-23 17:15:52] cmb@php.net
Confirmed: <https://3v4l.org/WHMPZ>.
------------------------------------------------------------------------
[2014-06-01 19:26:48] kmiller68 at gmail dot com
Description:
------------
ArrayObject does not appear to be serializing the classname of the iterator. When an ArrayObject is
deserialized the iterator is always set to the default ArrayIterator class.
Test script:
---------------
<?php
class MyIterator extends ArrayIterator {}
$a = new ArrayObject();
$a->setIteratorClass('MyIterator');
var_dump($a->getIteratorClass());
var_dump($a->serialize());
var_dump(unserialize(serialize($a))->getIteratorClass());
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67369&edit=1
Thread (3 messages)