5.0.0 - 普通 - 未处理
版本:5.0.20config.php中配置exception_handle使用闭包,生成配置缓存optimize:config后,由于使用闭包导致生成的init.php有问题,然后就悲剧了。
生成init.php直接使用var_dump会存在问题。估计那几个缓存生成都有类似的问题。
thinkphp/library/think/console/command/optimize/Config.php 90行附近
// 加载公共文件
if (is_file($path . 'common' . EXT)) {
$content .= substr(php_strip_whitespace($path . 'common' . EXT), 5) . PHP_EOL;
}
$content .= '\think\Config::set(' . var_export(ThinkConfig::get(), true) . ');';
return $content;
config.php中使用闭包
'exception_handle' => function (Exception $e) {
// 请求异常
if($e instanceof \think\exception\HttpException){
trace($e->getMessage(),'error');
}
},
