top-think/think

php7.4下行为层bug

Opened this issue · 0 comments

tp5.1 在 php7.4下行为层bug:

模块的 tags.php文件如下:

return [

    // 操作开始执行
    'action_begin' => [
        \app\common\behavior\CheckLogin::class
    ],

];

CheckLogin.php 示例代码:


class CheckLogin extends Controller
{
    /**
     * 行为登录验证
     */
    public function run(){
        $link  = strtolower(Request::module()."/".Request::controller());
        dump($link);
    }
}

现在的问题是:
在PHP7.3下,访问页面可以进入到该方法中;但在PHP7.4下无法进入到run()方法中,需要将该方法绑定到app_begin上:

    // 应用开始
    'app_begin'    => [
        \app\common\behavior\CheckLogin::class
    ],

才可以监听到run()方法。
分别测试了php7.4.3和php7.4.10两个版本。