瀏覽代碼

Ensure that iterators returned by multi-bulk replies inside a pipeline are stored in the replies buffer as arrays.

Daniele Alessandri 15 年之前
父節點
當前提交
701e06443c
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      lib/Predis.php

+ 5 - 1
lib/Predis.php

@@ -435,7 +435,11 @@ class CommandPipeline {
             $connection->writeCommand($command);
         }
         for ($i = 0; $i < $sizeofPipe; $i++) {
-            $this->_returnValues[] = $connection->readResponse($commands[$i]);
+            $response = $connection->readResponse($commands[$i]);
+            $this->_returnValues[] = ($response instanceof \Iterator
+                ? iterator_to_array($response)
+                : $response
+            );
             unset($commands[$i]);
         }
     }