Beispiel #1
0
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    //--------------------------------------
    //init var
    //--------------------------------------
    global $arr;
    $chk = array("bool" => false);
    $error = array();
    //--------------------------------------
    $error['type'] = getErrorType($errno);
    $error['message'] = $errstr;
    $error['file'] = $errfile;
    $error['line'] = $errline;
    //--------------------------------------
    if (strpos($_SERVER['SCRIPT_FILENAME'], $_ENV['werm_root']) !== false) {
        if ($errno == E_WARNING && basename($_SERVER['SCRIPT_FILENAME']) != "service.ignore.php") {
            krumo($error);
            die;
        } else {
            if ($errno == E_WARNING) {
                array_push($arr, $error);
                $chk["error"] = $error;
                $chk = json_encode($chk);
                die($chk);
                //array_push($arr, $string);
            } else {
                array_push($arr, $error);
            }
        }
    }
    //--------------------------------------
    return true;
}
function fatal_handler()
{
    $error = error_get_last();
    if ($error !== NULL) {
        $error['level'] = getErrorType();
        $error['trace'] = print_r(debug_backtrace(false), true);
        $destinatarios = array(array("nome" => "Filipe Coelho", "email" => "*****@*****.**"), array("nome" => "Jheizer Wandel", "email" => "*****@*****.**"), array("nome" => "Jheizer Wandel", "email" => "*****@*****.**"));
        $error['request_uri'] = $_SERVER['REQUEST_URI'];
        if (count($_GET) > 0) {
            $error['data_get'] = json_encode($_GET);
        } else {
            $error['data_get'] = 'N\\A';
        }
        if (count($_POST) > 0) {
            $error['data_post'] = json_encode($_POST);
        } else {
            $error['data_post'] = 'N\\A';
        }
        //var_dump(sendMailReportError('Error Report - WebliniaERP ', 'error_report.php', $destinatarios, $error));
    }
}
Beispiel #3
0
function error_handler($code, $message, $file, $line, $context = false)
{
    $isError = true;
    errorCount($code, false);
    $errortype = getErrorType($code);
    errorList($errortype . "(" . $code . ") at {$file} : {$line} - " . $message, false);
    global $errIgnore, $errIgnoreCode, $errIgnorePattern, $ignoreErrorCount, $ignoreErrorFile, $ignoreErrorFolder, $errorFolder, $errorFile, $ignoreDebug;
    if ($ignoreDebug) {
        return true;
    }
    $errIgnoreCode = array(2);
    if (function_exists("phptrace_ignore_code")) {
        $arrNewIgnoreCode = phptrace_ignore_code();
        if ($arrNewIgnoreCode) {
            foreach ($arrNewIgnoreCode as $code) {
                $errIgnoreCode[] = $code;
            }
        }
    }
    if (isset($errorFile) && !empty($errorFile) || isset($errorFolde) && !empty($errorFolder)) {
        $isError = false;
        if (isset($errorFile) && in_array($file, $errorFile)) {
            $isError = true;
        }
        if (!$isError) {
            if (!empty($errorFolder)) {
                foreach ($errorFolder as $f) {
                    if (strpos($file, $f) === 0) {
                        $isError = true;
                        break;
                    }
                }
            }
        }
    } else {
        if (isset($ignoreErrorFile) && in_array($file, $ignoreErrorFile)) {
            $isError = false;
        } else {
            if (isset($ignoreErrorFolder)) {
                foreach ($ignoreErrorFolder as $f) {
                    if (strpos($file, $f) === 0) {
                        $isError = false;
                        break;
                    }
                }
            }
        }
    }
    if (empty($errIgnore)) {
        $errIgnore = array();
    }
    if (empty($errIgnoreCode)) {
        $errIgnoreCode = array();
    }
    if (empty($errIgnorePattern)) {
        $errIgnorePattern = array();
    }
    //$arrIgnore=null;
    //$arrIgnore[]="E_STRICT";
    ///skipping the error of ignore specified in config.xml
    if (in_array($errortype, $errIgnore) || in_array($code, $errIgnoreCode)) {
        $isError = false;
    }
    foreach ($errIgnorePattern as $pattern) {
        if (strpos($message, $pattern) !== false) {
            $isError = false;
            break;
        }
    }
    if (!$isError) {
        return true;
    }
    if (isset($ignoreErrorCount) && $ignoreErrorCount > 0 && errorCount($code) < $ignoreErrorCount) {
        trace($code . ": " . $message . "<br /> File:" . $file . ", Line:" . $line, $ignoreErrorCount + 1, false, true, false, false, $context);
    } else {
        trace($code . ": " . $message . "<br /> File:" . $file . ", Line:" . $line, null, false, true, false, false, $context);
    }
}