diff --git a/src/Abuse/Adapters/TimeLimit/Redis.php b/src/Abuse/Adapters/TimeLimit/Redis.php index d4b27e4d42..3b93684f9d 100644 --- a/src/Abuse/Adapters/TimeLimit/Redis.php +++ b/src/Abuse/Adapters/TimeLimit/Redis.php @@ -84,7 +84,7 @@ class Redis extends TimeLimit * * @param int|null $offset * @param int|null $limit - * @return array + * @return array */ public function getLogs(?int $offset = null, ?int $limit = 25): array { @@ -93,10 +93,26 @@ class Redis extends TimeLimit $pattern = self::NAMESPACE . '__*'; do { - [$cursor, $keys] = $this->redis->scan($cursor, $pattern, $limit); + /** @var array{0: string|false, 1: array} */ + $result = $this->redis->scan($cursor, $pattern, $limit); + + if ($result === false) { + break; + } + + [$newCursor, $keys] = $result; + $cursor = (int)$newCursor; + if (!empty($keys)) { + /** @var array */ $values = $this->redis->mget($keys); - $matches = array_merge($matches, array_combine($keys, $values)); + if ($values !== false) { + /** @var array */ + $combinedArray = array_combine($keys, $values); + if ($combinedArray !== false) { + $matches = array_merge($matches, $combinedArray); + } + } } } while ($cursor > 0 && (!$limit || count($matches) < $limit));