Merge pull request #8428 from sminnee/fix-2636

FIX: Don’t change state in ArrayList::getIterator()
This commit is contained in:
Robbie Averill 2018-10-03 13:11:39 +02:00 committed by GitHub
commit 79f9d6b733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,12 +84,13 @@ class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, L
*/ */
public function getIterator() public function getIterator()
{ {
foreach ($this->items as $i => $item) { $items = array_map(
if (is_array($item)) { function ($item) {
$this->items[$i] = new ArrayData($item); return is_array($item) ? new ArrayData($item) : $item;
} },
} $this->items
return new ArrayIterator($this->items); );
return new ArrayIterator($items);
} }
/** /**