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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kmiller68 at gmail dot com
New email:
PHP Version: OS:

 

 [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>.
 [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: Tue Mar 19 07:01:29 2024 UTC