Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: How do I get PHP errors to display? #10167
    blanklintab
    Participant

    You can add your own custom error handler, which can provide extra debug information. Furthermore, you can set it up to send you the information via email.

    function ERR_HANDLER($errno, $errstr, $errfile, $errline){
        $msg = "<b>Something bad happened.</b> [$errno] $errstr <br><br>
        <b>File:</b> $errfile <br>
        <b>Line:</b> $errline <br>
        <pre>".json_encode(debug_backtrace(), JSON_PRETTY_PRINT)."</pre> <br>";
    
        echo $msg;
    
        return false;
    }
    
    function EXC_HANDLER($exception){
        ERR_HANDLER(0, $exception->getMessage(), $exception->getFile(), $exception->getLine());
    }
    
    function shutDownFunction() {
        $error = error_get_last();
        if ($error["type"] == 1) {
            ERR_HANDLER($error["type"], $error["message"], $error["file"], $error["line"]);
        }
    }
    
    set_error_handler ("ERR_HANDLER", E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
    register_shutdown_function("shutdownFunction");
    set_exception_handler("EXC_HANDLER");
    
Viewing 1 post (of 1 total)