Beispiel #1
0
function mc_error_handler($p_type, $p_error, $p_file, $p_line, $p_context)
{
    global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
    global $g_lang_overrides;
    global $g_error_send_page_header;
    global $l_oServer;
    # check if errors were disabled with @ somewhere in this call chain
    # also suppress php 5 strict warnings
    if (0 == error_reporting() || 2048 == $p_type) {
        return;
    }
    $t_lang_pushed = false;
    # flush any language overrides to return to user's natural default
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            lang_push(lang_get_default());
            $t_lang_pushed = true;
        }
    }
    $t_short_file = basename($p_file);
    $t_method_array = config_get('display_errors');
    if (isset($t_method_array[$p_type])) {
        $t_method = $t_method_array[$p_type];
    } else {
        $t_method = 'none';
    }
    # build an appropriate error string
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            $t_error_description = $p_error;
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            $t_error_description = $p_error;
            break;
        case E_USER_ERROR:
            $t_error_type = "APPLICATION ERROR #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_WARNING:
            $t_error_type = "APPLICATION WARNING #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            $t_error_description = $p_error;
            break;
        default:
            #shouldn't happen, just display the error just in case
            $t_error_type = '';
            $t_error_description = $p_error;
    }
    $t_error_description = $t_error_description;
    $t_error_stack = error_get_stack_trace();
    $l_oServer->fault('Server', "Error Type: {$t_error_type},\nError Description:\n{$t_error_description},\nStack Trace:\n{$t_error_stack}");
    $l_oServer->send_response();
    exit;
}
Beispiel #2
0
/**
 * Default error handler
 *
 * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* errors.
 *
 * E_USER_* are triggered by us and will contain an error constant in $p_error
 * The others, being system errors, will come with a string in $p_error
 * @param integer $p_type    Contains the level of the error raised, as an integer.
 * @param string  $p_error   Contains the error message, as a string.
 * @param string  $p_file    Contains the filename that the error was raised in, as a string.
 * @param integer $p_line    Contains the line number the error was raised at, as an integer.
 * @param array   $p_context To the active symbol table at the point the error occurred (optional).
 * @return void
 */
function mc_error_handler($p_type, $p_error, $p_file, $p_line, array $p_context)
{
    # check if errors were disabled with @ somewhere in this call chain
    # also suppress php 5 strict warnings
    if (0 == error_reporting() || 2048 == $p_type) {
        return;
    }
    # flush any language overrides to return to user's natural default
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            lang_push(lang_get_default());
        }
    }
    # build an appropriate error string
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            $t_error_description = $p_error;
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            $t_error_description = $p_error;
            break;
        case E_USER_ERROR:
            $t_error_type = 'APPLICATION ERROR #' . $p_error;
            $t_error_description = error_string($p_error);
            break;
        case E_USER_WARNING:
            $t_error_type = 'APPLICATION WARNING #' . $p_error;
            $t_error_description = error_string($p_error);
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            $t_error_description = $p_error;
            break;
        default:
            #shouldn't happen, just display the error just in case
            $t_error_type = '';
            $t_error_description = $p_error;
    }
    $t_error_stack = error_get_stack_trace();
    error_log('[mantisconnect.php] Error Type: ' . $t_error_type . ',' . "\n" . 'Error Description: ' . $t_error_description . "\n" . 'Stack Trace:' . "\n" . $t_error_stack);
    throw new SoapFault('Server', 'Error Type: ' . $t_error_type . ',' . "\n" . 'Error Description: ' . $t_error_description);
}
function mc_error_handler($p_type, $p_error, $p_file, $p_line, $p_context)
{
    global $l_oServer;
    # check if errors were disabled with @ somewhere in this call chain
    # also suppress php 5 strict warnings
    if (0 == error_reporting() || 2048 == $p_type) {
        return;
    }
    # flush any language overrides to return to user's natural default
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            lang_push(lang_get_default());
        }
    }
    # build an appropriate error string
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            $t_error_description = $p_error;
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            $t_error_description = $p_error;
            break;
        case E_USER_ERROR:
            $t_error_type = "APPLICATION ERROR #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_WARNING:
            $t_error_type = "APPLICATION WARNING #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            $t_error_description = $p_error;
            break;
        default:
            #shouldn't happen, just display the error just in case
            $t_error_type = '';
            $t_error_description = $p_error;
    }
    $t_error_stack = error_get_stack_trace();
    error_log("[mantisconnect.php] Error Type: {$t_error_type},\nError Description: {$t_error_description}\nStack Trace:\n{$t_error_stack}");
    $l_oServer->fault('Server', "Error Type: {$t_error_type},\nError Description: {$t_error_description}");
    $l_oServer->send_response();
    exit;
}