diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index bbddde2..8b4edaf 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2979,6 +2979,27 @@ function &drupal_register_shutdown_function($callback = NULL) {
  * Internal function used to execute registered shutdown functions.
  */
 function _drupal_shutdown_function() {
+
+  $isError = false;
+  if ($error = error_get_last()){
+    switch($error['type']){
+      case E_ERROR:
+      case E_CORE_ERROR:
+      case E_COMPILE_ERROR:
+      case E_USER_ERROR:
+        $isError = true;
+        break;
+    }
+  }
+  if ($isError){
+    // Do not expose DRUPAL_ROOT, if possible.
+    $root_length = strlen(DRUPAL_ROOT);
+    if (substr($error['file'], 0, $root_length) == DRUPAL_ROOT) {
+      $error['file'] = substr($error['file'], $root_length + 1);
+    }
+    print "<strong>This site has experienced a fatal error:</strong><br /> {$error['message']} at {$error['file']}:{$error['line']}";
+  }
+
   $callbacks = &drupal_register_shutdown_function();
 
   // Set the CWD to DRUPAL_ROOT as it is not guaranteed to be the same as it
