swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

composer update了一下,结果惨大了!上下文丢失!! #929

Closed porsion closed 5 years ago

porsion commented 5 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.5-beta
Swoole version 4.4.2 (by php --ri swoole)
PHP version 7.2.21 (by php -v)
Runtime environment CentOS 7

Details 这个swoft的框架用着都好的,学得也差不多了,也正在试着用它写项目。 因操作失误,在项目目录来了一下composer update 这下好了。再运行swoft的时候,要求swoole版本必须大于4.4.1,本来是4.3.5,然后升级了swoole到4.4.2。 本想着这下好了吧,结果再次 php ./bin/sowft http:start的时候,出现了如下问题: context information has been lost of the coID:-1; 详细的error: PHP Fatal error: Uncaught TypeError: Return value of context() must implement interface Swoft\Contract\ContextInterface, null returned in /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/framework/src/Helper/Functions.php:151 Stack trace:

0 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Logger.php(231): context()

1 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Logger.php(185): Swoft\Log\Logger->formatRecord('trace[DefaultEx...', Array, 400, 'error', Object(DateTime), Array)

2 /mnt/hgfs/e-swoole/zoodt.com/vendor/monolog/monolog/src/Monolog/Logger.php(707): Swoft\Log\Logger->addRecord(400, 'trace[DefaultEx...', Array)

3 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Helper/Log.php(118): Monolog\Logger->error('Pool error is C...')

4 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/error/src/DefaultExceptionHandler.php(29): Swoft\Log\Helper\Log::error('Pool error is C...')

5 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/error/src/DefaultErrorDispatcher.php(94): Swoft\Error\DefaultExceptionHandler->handle(Object(Swoft\Db\Exception\D in /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/framework/src/Helper/Functions.php on line 151

PHP Fatal error: Uncaught ErrorException: Uncaught TypeError: Return value of context() must implement interface Swoft\Contract\ContextInterface, null returned in /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/framework/src/Helper/Functions.php:151 Stack trace:

0 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Logger.php(231): context()

1 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Logger.php(185): Swoft\Log\Logger->formatRecord('trace[DefaultEx...', Array, 400, 'error', Object(DateTime), Array)

2 /mnt/hgfs/e-swoole/zoodt.com/vendor/monolog/monolog/src/Monolog/Logger.php(707): Swoft\Log\Logger->addRecord(400, 'trace[DefaultEx...', Array)

3 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/log/src/Helper/Log.php(118): Monolog\Logger->error('Pool error is C...')

4 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/error/src/DefaultExceptionHandler.php(29): Swoft\Log\Helper\Log::error('Pool error is C...')

5 /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/error/src/DefaultErrorDispatcher.php(94): Swoft\Error\DefaultExceptionHandler->handle(Ob in /mnt/hgfs/e-swoole/zoodt.com/vendor/swoft/framework/src/Helper/Functions.php on line 151

实在搞不懂了,试着把swoft退回到以前,还是不行。本人新手,好多地方都不太懂。就上面这个问题,找了半天也不知道是怎么回事

inhere commented 5 years ago

你把 vendor/swoft/error/src/DefaultExceptionHandler.php(29) 这行的 Log::error 注释掉

再运行看看

G-Bruin commented 5 years ago

今天也遇到这个问题,是config里面文件中的问题,环境变量 dev, prod ,需要自己手动建立文件夹

stelin commented 5 years ago

这个问题2.0.6 已经修复

stelin commented 5 years ago

问题已经修复,请更新至 2.0.6