热重载异常,在写代码的过程中,路由缺失,会报错

wybwsk

问题描述

在写控制器,然后路由里面没有配置。这时这个控制器是没有调用的,一保存,热重载时就会报下面的错。

报错信息

PHP Warning:  Uncaught Error: Object of class UnwindExit could not be converted to string in /www/wwwroot/api.testwebman.com/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php:27
Stack trace:                                                                                                                                                                                                
#0 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(582): include()                                                                                                                      
#1 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(433): Composer\Autoload\{closure}()                                                                                                  
#2 /www/wwwroot/api.testwebman.com/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php(26): Composer\Autoload\ClassLoader->loadClass()                                                         
#3 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(582): include('...')                                                                                                                 
#4 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(433): Composer\Autoload\{closure}()                                                                                                  
#5 /www/wwwroot/api.testwebman.com/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(27): Composer\Autoload\ClassLoader->loadClass()                                                   
#6 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(582): include('...')                                                                                                                 
#7 /www/wwwroot/api.testwebman.com/vendor/composer/ClassLoader.php(433): Composer\Autoload\{closure}()                                                                                                  
#8 /www/wwwroot/api.testwebman.com/vendor/workerman/webman-framework/src/support/Log.php(93): Composer\Autoload\ClassLoader->loadClass()                                                                
#9 /www/wwwroot/api.testwebman.com/vendor/workerman/webman-framework/src/support/Log.php(77): support\Log::handler()                                                                                    
#10 /www/wwwroot/api.testwebman.com/vendor/workerman/webman-framework/src/support/Log.php(55): support\Log::handlers()                                                                                  
#11 /www/wwwroot/api.testwebman.com/vendor/workerman/webman-framework/src/support/App.php(105): support\Log::channel()                                                                                  
#12 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(2457): support\App::support\{closure}()                                                                                       
#13 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(1579): Workerman\Worker->run()                                                                                                
#14 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(1420): Workerman\Worker::forkOneWorkerForLinux()                                                                              
#15 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(1394): Workerman\Worker::forkWorkersForLinux()                                                                                
#16 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(1725): Workerman\Worker::forkWorkers()                                                                                        
#17 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(1665): Workerman\Worker::monitorWorkersForLinux()                                                                             
#18 /www/wwwroot/api.testwebman.com/vendor/workerman/workerman/Worker.php(562): Workerman\Worker::monitorWorkers()                                                                                      
#19 /www/wwwroot/api.testwebman.com/vendor/workerman/webman-framework/src/support/App.php(131): Workerman\Worker::runAll()                                                                              
#20 /www/wwwroot/api.testwebman.com/vendor/webman/console/src/Commands/StartCommand.php(29): support\App::run()                                                                                         
#21 /www/wwwroot/api.testwebman.com/vendor/symfony/console/Command/Command.php(291): Webman\Console\Commands\StartCommand->execute()                                                                    
#22 /www/wwwroot/api.testwebman.com/vendor/symfony/console/Application.php(1014): Symfony\Component\Console\Command\Command->run()                                                                      
#23 /www/wwwroot/api.testwebman.com/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()                                                                  
#24 /www/wwwroot/api.testwebman.com/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()                                                                         
#25 /www/wwwroot/api.testwebman.com/webman(45): Symfony\Component\Console\Application->run()                                                                                                            
#26 {main}                                                                                                                                                                                                  
  thrown in /www/wwwroot/api.testwebman.com/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php on line 27        

操作系统及workerman/webman等框架组件具体版本

"php": ">=8.0",
"workerman/webman-framework": "^1.4.3"
998 1 0
1个回答

keytehu

报错文件和行数都给你了,自己看下就知道什么问题了。
vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php 里第 27行有问题,打开看下 UnwindExit 是哪来的。如果你看不懂就贴出来

  • wybwsk 2023-02-18

    就是这27号就一个定义。。不明白为啥会报错。。

    abstract class AbstractProcessingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface {
    }
  • keytehu 2023-02-18

    有可能是 monolog/monolog 版本问题,
    composer info 看下monolog/monolog 版本。
    不行就升级下 monolog/monolog

  • wybwsk 2023-02-20

    monolog/monolog是2.9.1,3以上要8.1的环境。原来是是8.0。先弄了,到时再升到8.1试试。

年代过于久远,无法发表回答
×
🔝