Browse Source

don't modify args before calling `func_get_args()`

because in PHP7, func_get_args() will return the current scoped variable value
antograssiot 10 years ago
parent
commit
0dbe486f5c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Collection/CollectionTrait.php

+ 2 - 1
src/Collection/CollectionTrait.php

@@ -587,10 +587,11 @@ trait CollectionTrait
      */
     public function zipWith($items, $callable)
     {
-        $items = [$items];
         if (func_num_args() > 2) {
             $items = func_get_args();
             $callable = array_pop($items);
+        } else {
+            $items = [$items];
         }
         return new ZipIterator(array_merge([$this], $items), $callable);
     }