php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67369 ArrayObject serialization drops the iterator class
Submitted: 2014-06-01 19:26 UTC Modified: 2020-04-15 14:59 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: Closed Package: SPL related
PHP Version: 5.5.13 OS: OSX/Unix
Private report: No CVE-ID: None
 [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

Pull Requests

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>.
 [2020-04-15 14:59 UTC] nikic@php.net
-Summary: serialization drops the iterator class. +Summary: ArrayObject serialization drops the iterator class
 [2020-04-20 09:57 UTC] nikic@php.net
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
 [2020-04-20 09:57 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC