Invoke trigger_error() using a fatal error that will terminate the request.

Normally, Drupal's error handler does not terminate script execution on user-level errors, even if the error is of type E_USER_ERROR. This function triggers an error of type E_USER_ERROR that is explicitly forced to be a fatal error which terminates script execution.

Parameters

string $error_msg: The error message to trigger. As with trigger_error() itself, this is limited to 1024 bytes; additional characters beyond that will be removed.

See also

_drupal_error_handler_real()

3 calls to drupal_trigger_fatal_error()
DeleteQuery::__toString in includes/database/query.inc
Implements PHP magic __toString method to convert the query to a string.
SelectQuery::__toString in includes/database/select.inc
Implements PHP magic __toString method to convert the query to a string.
UpdateQuery::__toString in includes/database/query.inc
Implements PHP magic __toString method to convert the query to a string.
2 string references to 'drupal_trigger_fatal_error'
_drupal_error_handler_real in includes/errors.inc
Provides custom PHP error handling.
_drupal_get_last_caller in includes/errors.inc
Gets the last caller from a backtrace.

File

includes/bootstrap.inc, line 1202
Functions that need to be loaded on every Drupal request.

Code

function drupal_trigger_fatal_error($error_msg) {
  $fatal_error =& drupal_static(__FUNCTION__, FALSE);
  $fatal_error = TRUE;
  trigger_error($error_msg, E_USER_ERROR);
  $fatal_error = FALSE;

  // The standard Drupal error handler should have treated this as a fatal
  // error and already ended the page request. But in case another error
  // handler is being used, terminate execution explicitly here also.
  exit;
}