Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

webman-console 命令行运行报错 #2

Open
yuanzhihai opened this issue Feb 24, 2022 · 7 comments
Open

webman-console 命令行运行报错 #2

yuanzhihai opened this issue Feb 24, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@yuanzhihai
Copy link

PHP Fatal error: Uncaught Error: Call to a member function add() on null in /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Connection/AsyncTcpConnection.php:213
Stack trace:
#0 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/redis/src/Client.php(444): Workerman\Connection\AsyncTcpConnection->connect()
#1 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/redis/src/Client.php(275): Workerman\Redis\Client->connect()
#2 /Users/yuanzhihai/Sites/local/webman/vendor/tinywan/casbin/src/Watcher/RedisWatcher.php(94): Workerman\Redis\Client->__construct('redis://127.0.0...')
#3 /Users/yuanzhihai/Sites/local/webman/vendor/tinywan/casbin/src/Watcher/RedisWatcher.php(40): Tinywan\Casbin\Watcher\RedisWatcher->createRedisClient(Array)
#4 /Users/yuanzhihai/Sites/local/webman/vendor/tinywan/casbin/src/Permission.php(73): Tinywan\Casbin\Watcher\RedisWatcher->__construct(Array)
#5 /Users/yuanzhihai/Sites/local/webman/support/bootstrap.php(77): Tinywan\Casbin\Permission::start(NULL)
#6 /Users/yuanzhihai/Sites/local/webman/webman(6): require_once('/Users/yuanzhih...')
#7 {main}
thrown in /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 213

@yuanzhihai
Copy link
Author

使用 webman 命令行 报错的

@yuanzhihai yuanzhihai changed the title 不清楚那是使用的不对 webman-console 命令行运行报错 Feb 24, 2022
@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

你的Redis配偶配置了没有?

@yuanzhihai
Copy link
Author

配置了

'default' => [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'database' => 0,
],
我队列使用的好好的

@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

你下载个最新版本的webman试试,你这是部分文件没升级导致的

@yuanzhihai
Copy link
Author

一样的

@walkor
Copy link

walkor commented Feb 24, 2022

image

https://github.com/Tinywan/casbin/blob/4908f2fff39f5086a7c67ec0d012d9ec195a79a0/src/Permission.php#L60

workerman/redis 只能运行在workerman的运行环境,所以在Tinywan\Casbin\Permission::start($worker)方法里要判断下是不是workerman的运行环境。判断方法是判断下$worker是不是null。 如果是null就不做casbin初始化或者选择性初始化,避免报错。

@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

@yzh52521 使用最新版本 v0.0.8

@Tinywan Tinywan added the bug Something isn't working label Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants