Beispiel #1
0
/**
 * ocPortal error catcher for fatal versions. This is hooked in only on PHP5.2 as error_get_last() only works on these versions.
 */
function catch_fatal_errors()
{
    if (!function_exists('error_get_last')) {
        return;
    }
    $error = error_get_last();
    if (!is_null($error)) {
        if (!array_key_exists('message', $error)) {
            return;
        }
        // Needed for HipHop PHP
        if (substr($error['message'], 0, 26) == 'Maximum execution time of ') {
            if (function_exists('i_force_refresh')) {
                i_force_refresh();
            }
        }
        //$tmp=$GLOBALS;unset($tmp['GLOBALS']);@var_dump($tmp);@exit();
        //@var_dump(get_defined_functions()); exit(); // Useful for debugging memory problems, finding unneeded stuff that is loaded
        switch ($error['type']) {
            case E_ERROR:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            case E_USER_ERROR:
                $GLOBALS['SUPPRESS_ERROR_DEATH'] = false;
                // We can't recover as we've lost our execution track. Force a nice death rather than trying to display a recoverable error.
                $GLOBALS['DYING_BADLY'] = true;
                // Does not actually work unfortunately. @'d calls never get here at all.
                ocportal_error_handler($error['type'], $error['message'], $error['file'], $error['line']);
        }
    }
}
Beispiel #2
0
/**
 * ocPortal error catcher for fatal versions. This is hooked in only on PHP5.2 as error_get_last() only works on these versions.
 */
function catch_fatal_errors()
{
    if (!function_exists('error_get_last')) {
        return;
    }
    $error = error_get_last();
    if (!is_null($error)) {
        if (substr($error['message'], 0, 26) == 'Maximum execution time of ') {
            if (function_exists('i_force_refresh')) {
                i_force_refresh();
            }
        }
        switch ($error['type']) {
            case E_ERROR:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            case E_USER_ERROR:
                $GLOBALS['SUPPRESS_ERROR_DEATH'] = false;
                // We can't recover as we've lost our execution track. Force a nice death rather than trying to display a recoverable error.
                $GLOBALS['DYING_BADLY'] = true;
                // Does not actually work unfortunately. @'d calls never get here at all.
                ocportal_error_handler($error['type'], $error['message'], $error['file'], $error['line']);
        }
    }
}