|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-12-29 10:31 UTC] spinkus at epicmorsel dot com
-PHP Version: 5.4.36
+PHP Version: 5.4.35
[2014-12-29 10:31 UTC] spinkus at epicmorsel dot com
[2014-12-29 10:35 UTC] spinkus at epicmorsel dot com
[2017-12-22 17:36 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2017-12-22 17:36 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 11:00:01 2025 UTC |
Description: ------------ RecursiveIteratorIterator fails to Recurse into class implementing iteratorAggregate and returning RecursiveArrayIterator on private data. See test script. Test script: --------------- class X implements IteratorAggregate { private $data = ['X', 'X', 'X']; # public $data = ['X', 'X', 'X']; public function __construct($data = null) { $this->data = isset($data) ? $data : $this->data; } public function getIterator() { return new RecursiveArrayIterator($this->data); } } $x = new X([1, 2, new X(), 5]); $it = new RecursiveIteratorIterator($x); foreach($it as $v) { var_dump($v); } Expected result: ---------------- Expecting no difference between public and private data. RecursiveArrayIterator should make a copy of the private data on construction.