diff --git a/src/Collection/CollectionTrait.php b/src/Collection/CollectionTrait.php index a3493de9cb3..e286f6dfc29 100644 --- a/src/Collection/CollectionTrait.php +++ b/src/Collection/CollectionTrait.php @@ -696,7 +696,7 @@ public function cartesianProduct(callable $operation = null, callable $filter = $collectionArraysKeys = []; $collectionArraysCounts = []; - foreach ($this as $value) { + foreach ($this->toList() as $value) { if (count($value) !== count($value, COUNT_RECURSIVE)) { throw new LogicException('Cannot find the cartesian product of a multidimensional array'); }