Kaynağa Gözat

Fix handling of the WEIGHT modifier for ZUNIONSTORE and ZINTERSTORE with more than two weights specified.

Daniele Alessandri 15 yıl önce
ebeveyn
işleme
73bdfc2d72
2 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 3 0
      CHANGELOG
  2. 3 2
      lib/Predis.php

+ 3 - 0
CHANGELOG

@@ -34,6 +34,9 @@ v0.6.1 (2010-xx-xx)
     Backwards compatibility with previous releases of Predis is ensured. 
     Backwards compatibility with previous releases of Predis is ensured. 
     The method Predis\Client::pipelineSafe() is to be considered deprecated.
     The method Predis\Client::pipelineSafe() is to be considered deprecated.
 
 
+  * FIX: The WEIGHT modifier for ZUNIONSTORE and ZINTERSTORE was handled 
+    incorrectly with more than two weights specified.
+
 v0.6.0 (2010-05-24)
 v0.6.0 (2010-05-24)
   * Switched to the new multi-bulk request protocol for all of the commands 
   * Switched to the new multi-bulk request protocol for all of the commands 
     in the Redis 1.2 and Redis 2.0 profiles. Inline and bulk requests are now 
     in the Redis 1.2 and Redis 2.0 profiles. Inline and bulk requests are now 

+ 3 - 2
lib/Predis.php

@@ -2550,8 +2550,9 @@ class ZSetUnionStore extends \Predis\MultiBulkCommand {
         $finalizedOpts = array();
         $finalizedOpts = array();
         if (isset($opts['WEIGHTS']) && is_array($opts['WEIGHTS'])) {
         if (isset($opts['WEIGHTS']) && is_array($opts['WEIGHTS'])) {
             $finalizedOpts[] = 'WEIGHTS';
             $finalizedOpts[] = 'WEIGHTS';
-            $finalizedOpts[] = $opts['WEIGHTS'][0];
-            $finalizedOpts[] = $opts['WEIGHTS'][1];
+            foreach ($opts['WEIGHTS'] as $weight) {
+                $finalizedOpts[] = $weight;
+            }
         }
         }
         if (isset($opts['AGGREGATE'])) {
         if (isset($opts['AGGREGATE'])) {
             $finalizedOpts[] = 'AGGREGATE';
             $finalizedOpts[] = 'AGGREGATE';