Skip to content

Commit

Permalink
Merge pull request #468 from magarzon/bugfix/null_payload_in_reserve
Browse files Browse the repository at this point in the history
In reserve method, if the payload is null, throws an error in PHP 8.1
  • Loading branch information
bizley committed Oct 3, 2023
2 parents 04ba02f + 489d74d commit 17fcf6a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/drivers/redis/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ protected function reserve($timeout)
}

$payload = $this->redis->hget("$this->channel.messages", $id);
if (null === $payload) {
return null;
}

list($ttr, $message) = explode(';', $payload, 2);
$this->redis->zadd("$this->channel.reserved", time() + $ttr, $id);
$attempt = $this->redis->hincrby("$this->channel.attempts", $id, 1);
Expand Down

0 comments on commit 17fcf6a

Please sign in to comment.