在生产模式代码点火器4上将CI_DEBUG设置为False时发生致命错误



为什么在生产模式下从Config/Boot/production.phpCI_DEBUG设置为false时会出现此错误?这是CI4的默认设置。

defined('CI_DEBUG'(|| define('CI.DEBUG',false(;

Fatal error: Declaration of CodeIgniterLogLogger::emergency($message, array $context = []): bool must be compatible with PsrLogLoggerInterface::emergency(Stringable|string $message, array $context = []): void in E:testingSource Codetesting_CI_v.4.2.6systemLogLogger.php on line 157
Fatal error: Uncaught Error: Class "CodeIgniterLogLogger" not found in E:testingSource Codetesting_CI_v.4.2.6systemConfigServices.php:391 Stack trace: #0 E:testingSource Codetesting_CI_v.4.2.6systemConfigBaseService.php(253): CodeIgniterConfigServices::logger(false) #1 E:testingSource Codetesting_CI_v.4.2.6systemConfigBaseService.php(194): CodeIgniterConfigBaseService::__callStatic('logger', Array) #2 E:testingSource Codetesting_CI_v.4.2.6systemConfigServices.php(388): CodeIgniterConfigBaseService::getSharedInstance('logger') #3 E:testingSource Codetesting_CI_v.4.2.6systemConfigBaseService.php(253): CodeIgniterConfigServices::logger(true) #4 E:testingSource Codetesting_CI_v.4.2.6systemCommon.php(799): CodeIgniterConfigBaseService::__callStatic('logger', Array) #5 E:testingSource Codetesting_CI_v.4.2.6systemDebugExceptions.php(114): log_message('critical', '{message}nin {e...', Array) #6 E:testingSource Codetesting_CI_v.4.2.6systemDebugExceptions.php(180): CodeIgniterDebugExceptions->exceptionHandler(Object(ErrorException)) #7 [internal function]: CodeIgniterDebugExceptions->shutdownHandler() #8 {main} thrown in E:testingSource Codetesting_CI_v.4.2.6systemConfigServices.php on line 391

对于开发和测试模式,运行时没有问题。此错误仅在使用路由时发生->资源(RESTFUL API(。

目前尚不清楚这是什么错误。我试图用新文件夹替换系统文件夹。但错误仍然存在。

据说"未捕获错误:类";CodeIgniter\Log\Logger";未找到">我不知道这个有什么问题,为什么找不到。

现在,我的应用程序只运行,并将CI_DEBUG设置为true以防止出现错误。但对于生产,默认设置为false

defined('CI_DEBUG'(||define('CI.DEBUG',true(;

这里缺少什么?奇怪的是,将CI_ENVIRONMENT设置为开发或测试可以毫无问题地工作。但生产不起作用。所以我决定在生产模式下打开错误显示,并发现了上面的错误。

真的需要帮助。

我在restful api中发现了这个问题。

问题出现在config/filter.php 中

$routes->resource('ApiManageTips', ['controller' =>'AppControllersApiDataApiManageTips']); // get, put, create, delete

public $filters = [                           
'basicauth'    => ['before' =>
[                              
'ApiManageTips/*',
'ApiManageTips',                                 
]
]
];

上面的例子适用于4.1.2版,但不适用于4.2.6版

改为:

public $filters = [                           
'basicauth'    => ['before' =>
[                              
'ApiManageTips/*',                                   
]
];

我不知道为什么它在CI 4.2.6版本中不起作用。

最新更新