Skip to content

Commit

Permalink
Check if data is countable
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Desilets committed Dec 5, 2024
1 parent b36c2f9 commit 323fd33
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Command/Redis/ZRANGE.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ public function parseResponse($data)
{
if ($this->withScores()) {
$result = [];

for ($i = 0; $i < count($data); ++$i) {
if (is_array($data[$i])) {
$result[$data[$i][0]] = $data[$i][1]; // Relay
} else {
$result[$data[$i]] = $data[++$i];
if (is_countable($data)) {
for ($i = 0; $i < count($data); ++$i) {
if (is_array($data[$i])) {
$result[$data[$i][0]] = $data[$i][1]; // Relay
} else {
$result[$data[$i]] = $data[++$i];
}
}
}

Expand Down

0 comments on commit 323fd33

Please sign in to comment.