Bug #67369 [Opn->Ver]: serialization drops the iterator class.
| From: | cmb@php.net | Date: | Sun, 23 Aug 2015 17:15:53 +0000 |
| Subject: | Bug #67369 [Opn->Ver]: serialization drops the iterator class. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195451@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67369&edit=1
ID: 67369
Updated by: cmb@php.net
Reported by: kmiller68 at gmail dot com
Summary: serialization drops the iterator class.
-Status: Open
+Status: Verified
Type: Bug
Package: SPL related
Operating System: OSX/Unix
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
Confirmed: <https://3v4l.org/WHMPZ>.
Previous Comments:
------------------------------------------------------------------------
[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