Open yuanzhihai opened 2 years ago
使用 webman 命令行 报错的
你的Redis配偶配置了没有?
配置了
'default' => [ 'host' => '127.0.0.1', 'password' => null, 'port' => 6379, 'database' => 0, ], 我队列使用的好好的
你下载个最新版本的webman试试,你这是部分文件没升级导致的
一样的
workerman/redis 只能运行在workerman的运行环境,所以在Tinywan\Casbin\Permission::start($worker)
方法里要判断下是不是workerman的运行环境。判断方法是判断下$worker是不是null。 如果是null就不做casbin初始化或者选择性初始化,避免报错。
@yzh52521 使用最新版本 v0.0.8
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