Unsupported operand types: int + string
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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