How to see errors suppressed by '@'?

前端 未结 2 1746
甜味超标
甜味超标 2021-01-17 17:39

I joined this crazy company as a Site Administrator. Now I did some changes to my db configurations which have impacted the PHP scripts execution.

Strange part is P

2条回答
  •  粉色の甜心
    2021-01-17 18:22

    Muted errors are still visible for the handler installed via set_error_handler. So you can just add something like this to your bootstrap file:

    set_error_handler(function ($errno, $errstr, $errfile, $errline) {
        echo "$errstr at $errfile($errline)\n";
    });
    

    or, better,

    set_error_handler(function ($errno, $errstr, $errfile, $errline) {
        throw new ErrorException($errstr, $errno, 1, $errfile, $errline);
    });
    

    which also would display the stack.

提交回复
热议问题