升级 php 版本后,蛋糕 php 中的所有错误现在都是 "An Internal Server Error Occurred"

After upgrading php version All Errors Are Now "An Internal Server Error Occurred" in cake php

我在用cake php 3. 几天前我把php版本从5.6更新到7.1.17。现在,如果我的应用程序发生任何错误,它会显示 An Internal Server Error Occurred"。我可以在我的 error.log 文件中看到这样的错误日志 [Error] Call to a member function user() on boolean Request URL: /robots.txt

下面是我的 user() 函数的调用方式。它在 php 5.6..

上运行良好
public function beforeRender(Event $event)
{
    if($this->Auth->user()){
        $this->set('loggedIn', true);
    }
    else{
        $this->set('loggedIn',false);
    }
}

我就是这样解决问题的。在 beforeRender 函数中添加了这一行 $this->loadComponent('Auth');。我从