Example #1
0
function gs_script_error($msg = '')
{
    gs_write_error('Error. ' . $msg . "\n\n");
    die(1);
}
Example #2
0
File: util.php Project: rkania/GS3
function err_handler_die_on_err($type, $msg, $file, $line)
{
    switch ($type) {
        case E_NOTICE:
        case E_USER_NOTICE:
        case E_DEPRECATED:
        case E_USER_DEPRECATED:
            if (error_reporting() != 0) {
                gs_log(GS_LOG_NOTICE, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line);
            } else {
                # suppressed by @
                //gs_log( GS_LOG_DEBUG , 'PHP: '. $msg .' in '. $file .' on line '. $line .' (suppressed)' );
            }
            break;
        case E_STRICT:
            if (error_reporting() != 0) {
                gs_log(GS_LOG_DEBUG, 'PHP (Strict): ' . $msg . ' in ' . $file . ' on line ' . $line);
            } else {
                # suppressed by @
                gs_log(GS_LOG_DEBUG, 'PHP (strict): ' . $msg . ' in ' . $file . ' on line ' . $line);
            }
            break;
        case E_ERROR:
        case E_USER_ERROR:
            gs_log(GS_LOG_FATAL, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line);
            gs_write_error('A fatal error occurred. See log for details.' . "\n");
            exit(1);
            break;
        case E_RECOVERABLE_ERROR:
            gs_log(GS_LOG_WARNING, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line);
            break;
        case E_WARNING:
        case E_USER_WARNING:
            if (error_reporting() != 0) {
                gs_log(GS_LOG_WARNING, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line);
                gs_write_error('A warning occurred. See log for details.' . "\n");
                exit(1);
            } else {
                # suppressed by @
                gs_log(GS_LOG_DEBUG, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line . ' (suppressed)');
            }
            break;
        default:
            gs_log(GS_LOG_WARNING, 'PHP: ' . $msg . ' in ' . $file . ' on line ' . $line);
            gs_write_error('A warning occurred. See log for details.' . "\n");
            exit(1);
            break;
    }
}