@@ -79,7 +79,7 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster|null $red
7979 $ sentinelMaster = $ options ['sentinel ' ] ?? $ options ['redis_sentinel ' ] ?? $ options ['sentinel_master ' ] ?? null ;
8080
8181 if (null !== $ sentinelMaster && !class_exists (\RedisSentinel::class) && !class_exists (Sentinel::class)) {
82- throw new InvalidArgumentException ('Redis Sentinel support requires ext-redis>=5.2 , or ext-relay. ' );
82+ throw new InvalidArgumentException ('Redis Sentinel support requires ext-redis>=6.1 , or ext-relay. ' );
8383 }
8484
8585 if (null !== $ sentinelMaster && $ redis instanceof \RedisCluster) {
@@ -697,6 +697,7 @@ public function getMessageCount(): int
697697 }
698698
699699 // Iterate through the stream. See https://redis.io/commands/xrange/#iterating-a-stream.
700+ $ useExclusiveRangeInterval = version_compare (phpversion ('redis ' ), '6.2.0 ' , '>= ' );
700701 $ total = 0 ;
701702 while (true ) {
702703 if (!$ range = $ redis ->xRange ($ this ->stream , $ lastDeliveredId , '+ ' , 100 )) {
@@ -705,7 +706,11 @@ public function getMessageCount(): int
705706
706707 $ total += \count ($ range );
707708
708- $ lastDeliveredId = preg_replace_callback ('#\d+$# ' , static fn (array $ matches ) => (int ) $ matches [0 ] + 1 , array_key_last ($ range ));
709+ if ($ useExclusiveRangeInterval ) {
710+ $ lastDeliveredId = preg_replace_callback ('#\d+$# ' , static fn (array $ matches ) => (int ) $ matches [0 ] + 1 , array_key_last ($ range ));
711+ } else {
712+ $ lastDeliveredId = '( ' .array_key_last ($ range );
713+ }
709714 }
710715 }
711716
0 commit comments