Преглед на файлове

Do not fail with empty transactions when using CAS.

Daniele Alessandri преди 14 години
родител
ревизия
99042f6b9c
променени са 2 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 1 1
      lib/Predis.php
  2. 9 0
      test/PredisClientFeatures.php

+ 1 - 1
lib/Predis.php

@@ -922,7 +922,7 @@ class MultiExecBlock {
                 }
             }
 
-            if ($this->_initialized === false) {
+            if ($this->_initialized === false || count($this->_commands) == 0) {
                 return;
             }
 

+ 9 - 0
test/PredisClientFeatures.php

@@ -569,7 +569,16 @@ class PredisClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
         $client->flushdb();
 
         $replies = $client->multiExec(function($multi) { });
+        $this->assertEquals(0, count($replies));
+
+        $options = array('cas' => true);
+        $replies = $client->multiExec($options, function($multi) { });
+        $this->assertEquals(0, count($replies));
 
+        $options = array('cas' => true);
+        $replies = $client->multiExec($options, function($multi) {
+            $multi->multi();
+        });
         $this->assertEquals(0, count($replies));
     }