宝塔用户_bbmslf 发表于 2024-6-25 23:42:13

【待反馈】用进程守护添加Validchec失败

为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:8.2.0
系统版本:系统:CentOS 7
问题描述:Validcheck这个进程启动不了
相关截图(日志、错误):开始...   ErrorException Attempt to read property "type" on nullat app/Helpers/functions.php:567    563▕   debug_log($key);    564▕   $locale = 'en';    565▕   if ($bot) {    566▕         debug_log($bot);➜ 567▕         $is_private = $bot->chat()->type == 'private';    568▕         if ($is_private) {    569▕             $locale = \App\Services\TelegramService::getuserLocale($bot);    570▕         } else {    571▕             $locale = \App\Services\ConfigService::getGroupLocale($bot->chatId());1   app/Helpers/functions.php:567      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}()2   app/Console/Commands/ValidCheckCommand.php:95      transx()


运维技术阿闯 发表于 2024-6-26 10:45:28

您好,app/Helpers/functions.php文件的第567行打开找到57行
在访问$bot对象的属性之前,确保$bot对象不为空。您可以在访问$bot对象的属性前添加一行代码进行空值检查,以避免出现类似错误。
if ($bot && $bot->chat() && $bot->chat()->type == 'private') {
    // Your code here
}
页: [1]
查看完整版本: 【待反馈】用进程守护添加Validchec失败