php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67369 serialization drops the iterator class.
Submitted: 2014-06-01 19:26 UTC Modified: 2015-08-23 17:15 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kmiller68 at gmail dot com Assigned:
Status: Verified Package: SPL related
PHP Version: 5.5.13 OS: OSX/Unix
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-06-01 19:26 UTC] 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());


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-23 17:15 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2015-08-23 17:15 UTC] cmb@php.net
Confirmed: <https://3v4l.org/WHMPZ>.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC