Skip to content

Commit ba94fe0

Browse files
committed
re-allow ext-redis 6.1
1 parent 805acc2 commit ba94fe0

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
7.4
55
---
66

7-
* Bump ext-redis to 6.2 and ext-relay to 0.12 minimum
7+
* Bump ext-redis to 6.1 and ext-relay to 0.12 minimum
88

99
7.3
1010
---

Transport/Connection.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"symfony/var-dumper": "^6.4|^7.0|^8.0"
2727
},
2828
"conflict": {
29-
"ext-redis": "<6.2",
29+
"ext-redis": "<6.1",
3030
"ext-relay": "<0.12"
3131
},
3232
"autoload": {

0 commit comments

Comments
 (0)