Daniele Alessandri 15 лет назад
Родитель
Сommit
ad48369a6b
2 измененных файлов с 6 добавлено и 3 удалено
  1. 3 1
      CHANGELOG
  2. 3 2
      lib/Predis.php

+ 3 - 1
CHANGELOG

@@ -8,7 +8,9 @@ v0.6.1 (2010-xx-xx)
     supported using an associative array passed as the last argument of their 
     respective methods.
 
-  * Added missing support for the LIMIT modifier of ZRANGEBYSCORE.
+  * The LIMIT modifier for ZRANGEBYSCORE can be specified using either: 
+      - an indexed array: array($offset, $count)
+      - an associative array: array('limit' => $limit, 'count' => $count)
 
   * The method Predis\Client::__construct() now accepts also instances of 
     Predis\ConnectionParameters.

+ 3 - 2
lib/Predis.php

@@ -2576,9 +2576,10 @@ class ZSetRangeByScore extends \Predis\Commands\ZSetRange {
         $opts = array_change_key_case($options, CASE_UPPER);
         $finalizedOpts = array();
         if (isset($opts['LIMIT']) && is_array($opts['LIMIT'])) {
+            $limit = array_change_key_case($opts['LIMIT'], CASE_UPPER);
             $finalizedOpts[] = 'LIMIT';
-            $finalizedOpts[] = $opts['LIMIT'][0];
-            $finalizedOpts[] = $opts['LIMIT'][1];
+            $finalizedOpts[] = isset($limit['OFFSET']) ? $limit['OFFSET'] : $limit[0];
+            $finalizedOpts[] = isset($limit['COUNT']) ? $limit['COUNT'] : $limit[1];
         }
         return array_merge($finalizedOpts, parent::prepareOptions($options));
     }