瀏覽代碼

Predis\Client::multiExec is now aware of iterable multi-bulk responses.

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

+ 8 - 2
lib/Predis.php

@@ -522,7 +522,10 @@ class MultiExecBlock {
                 $block($this);
                 $block($this);
             }
             }
 
 
-            $execReply = $this->_redisClient->exec();
+            $execReply = (($reply = $this->_redisClient->exec()) instanceof \Iterator
+                ? iterator_to_array($reply)
+                : $reply
+            );
             $commands  = &$this->_commands;
             $commands  = &$this->_commands;
             $sizeofReplies = count($execReply);
             $sizeofReplies = count($execReply);
 
 
@@ -532,7 +535,10 @@ class MultiExecBlock {
             }
             }
 
 
             for ($i = 0; $i < $sizeofReplies; $i++) {
             for ($i = 0; $i < $sizeofReplies; $i++) {
-                $returnValues[] = $commands[$i]->parseResponse($execReply[$i]);
+                $returnValues[] = $commands[$i]->parseResponse($execReply[$i] instanceof \Iterator
+                    ? iterator_to_array($execReply[$i])
+                    : $execReply[$i]
+                );
                 unset($commands[$i]);
                 unset($commands[$i]);
             }
             }
         }
         }