error_get_last() and custom error handler

前端 未结 2 1991
-上瘾入骨i
-上瘾入骨i 2021-01-05 09:46

odbc_errormsg does not report error messages from odbc_execute the way it\'s supposed to. It merely throws a warning. So I\'ve been forced to write a hack to parse the erro

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 10:25

    You could change your custom error handler to return false, just when the error is ignored (@-operator used).

    function custom_error_handler($errno, $errstr, $errfile, $errline){
        $ignore = ($errno & error_reporting()) == 0;
        if ($ignore) {
            return FALSE;
        }
        echo "[Error happened: $errstr]\n";
        return TRUE;
    }
    

提交回复
热议问题