function _drupal_error_handler_real

Same name in other branches
  1. 9 core/includes/errors.inc \_drupal_error_handler_real()
  2. 8.9.x core/includes/errors.inc \_drupal_error_handler_real()
  3. 10 core/includes/errors.inc \_drupal_error_handler_real()
  4. 11.x core/includes/errors.inc \_drupal_error_handler_real()

Provides custom PHP error handling.

Parameters

$error_level: The level of the error raised.

$message: The error message.

$filename: The filename that the error was raised in.

$line: The line number the error was raised at.

1 call to _drupal_error_handler_real()
_drupal_error_handler in includes/bootstrap.inc
Provides custom PHP error handling.

File

includes/errors.inc, line 52

Code

function _drupal_error_handler_real($error_level, $message, $filename, $line) {
    if ($error_level & error_reporting()) {
        $types = drupal_error_levels();
        list($severity_msg, $severity_level) = $types[$error_level];
        $caller = _drupal_get_last_caller(debug_backtrace());
        if (!function_exists('filter_xss_admin')) {
            require_once DRUPAL_ROOT . '/includes/common.inc';
        }
        // We treat recoverable errors as fatal, and also allow fatal errors to be
        // explicitly triggered by drupal_trigger_fatal_error().
        _drupal_log_error(array(
            '%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error',
            // The standard PHP error handler considers that the error messages
            // are HTML. We mimic this behavior here.
'!message' => filter_xss_admin($message),
            '%function' => $caller['function'],
            '%file' => $caller['file'],
            '%line' => $caller['line'],
            'severity_level' => $severity_level,
        ), $error_level == E_RECOVERABLE_ERROR || drupal_static('drupal_trigger_fatal_error'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.