yiisoft / yiisoft/yii2-queue

Unsupported operand types: int + string

Open
#526 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
PHP
Stars
1.1k
Forks
285
Avg merge
5d 3h
Merged PRs (30d)
2

Description

From time to time sentry logs this error: Unsupported operand types: int + string

Stacktrace:

$payload = $this->redis->hget("$this->channel.messages", $id);
list($ttr, $message) = explode(';', $payload, 2);
$this->redis->zadd("$this->channel.reserved", time() + $ttr, $id);

https://github.com/yiisoft/yii2-queue/blob/master/src/drivers/redis/Queue.php#L160

For whatever reason $ttr seems to be a string instead of an int. Should we maybe typecast $ttr or throw an exception?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect src/drivers/redis/Queue.php around line 160, starting with how the payload is split and how $ttr is obtained. Trace the Redis queue reservation path and determine how the integer/string mismatch should be handled; the issue is done when this Sentry error is prevented with an agreed behavior for invalid or string TTR values.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, redis
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.