Skip to content

Commit

Permalink
Add a clarifying comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 7, 2015
1 parent 2d6b59d commit 0043d2f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Collection/CollectionTrait.php
Expand Up @@ -470,6 +470,8 @@ public function toArray($preserveKeys = true)
$items = $iterator->getArrayCopy();
return $preserveKeys ? $items : array_values($items);
}
// RecursiveIteratorIterator can return duplicate key values causing
// data loss when converted into an array
if ($preserveKeys && get_class($iterator) === 'RecursiveIteratorIterator') {
$preserveKeys = false;
}
Expand Down

0 comments on commit 0043d2f

Please sign in to comment.