mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8428 from sminnee/fix-2636
FIX: Don’t change state in ArrayList::getIterator()
This commit is contained in:
commit
79f9d6b733
@ -84,12 +84,13 @@ class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, L
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
foreach ($this->items as $i => $item) {
|
||||
if (is_array($item)) {
|
||||
$this->items[$i] = new ArrayData($item);
|
||||
}
|
||||
}
|
||||
return new ArrayIterator($this->items);
|
||||
$items = array_map(
|
||||
function ($item) {
|
||||
return is_array($item) ? new ArrayData($item) : $item;
|
||||
},
|
||||
$this->items
|
||||
);
|
||||
return new ArrayIterator($items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user