不能查询到 uid,导致 foreach 遍历了 false值,报错,worker退出
- Dominant language
- PHP
- Stars
- 1k
- Forks
- 291
- PR merge metrics
- No merged PRs in 30d
Description

在不停的接收到message时,频繁的通过 Gateway::getUidByClientId($client_id); 查询UID,然而在 lib/Gateway.php 中的 getUidByClientId 方法中,$data 变量返回的值,有可能是这样的:
```
array(1) {
[2130706433]=>
array(1) {
[2000]=>
bool(false)
}
}
```
第三个 foreach 遍历 false 就出错了。
详细的打印记录,可见[error.txt](https://wwa.lanzoui.com/iTbMptv7h6f),false 在 日志中的 18267 行可见
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in lib/Gateway.php at getUidByClientId($client_id), then inspect the third foreach and the logged false value around line 18267 of error.txt. Reproduce the lookup under frequent message traffic and verify that an unexpected false result no longer causes foreach to fail or the worker to exit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100