Index: DefaultHandler.php
===================================================================
--- DefaultHandler.php	(revision 54105)
+++ DefaultHandler.php	(working copy)
@@ -202,6 +202,63 @@
 	}
 	
 	/**
+	 * Try and handle PHP errors that are not passed to the error_handler. To use this,
+	 * set error handling as follows:
+	 *
+	 * 	register_shutdown_function(array('Exception_DefaultHandler','handleShutdown'));
+	 *
+	 * This function will pass the last error that could not be handled as php does not sent
+	 * it to the defined "set_error_handler()"
+	 * 
+	 * Error output will not be show if display errors are on as there is no clean (ob buffering can be used)
+	 * way of suppressing the normal php output and there is no point in duplicating the same message
+	 */
+	public static function handleShutdown()
+	{
+		if ($error = error_get_last()){
+			switch($error['type']){
+				case E_ERROR:
+				case E_CORE_ERROR:
+				case E_COMPILE_ERROR:
+				case E_USER_ERROR:
+					$debug_backtrace = debug_backtrace();
+
+					// Clear the first element, which refers to the call to this class
+					unset($debug_backtrace[0]);
+
+					$backtrace = self::getBacktraceOutput($debug_backtrace);
+					$errtype = self::getPHPErrorDescription($error['type']);
+
+					$error_hash[] = strtoupper(substr(md5($error['type'] . $error['message']), 0, 4));
+					$error_hash[] = self::locationHash($error['file'], $error['line'], $debug_backtrace);
+					$error_hash = implode('/', $error_hash);
+
+					$additional_environment  = "PHP Error Type:     $errtype\n";
+					$additional_environment .= "PHP Error Details:  " . $error['message'] . "\n";
+					$additional_environment .= "Script location:    " . $error['file'] . "\n";
+					$additional_environment .= "Line Number:        " . $error['line'] . "\n";
+					self::writeLog($errtype, $error['message'], $error['file'], $error['line'], $backtrace);
+					self::sendEmail($backtrace, $additional_environment, $errtype, $error_hash);
+
+					/*
+					 * Only show errors if the errors have not already been show (diplay_errors is off)
+					 * and errors should not be suppressed
+					 */
+					$disp_err = ini_get('display_errors');
+					settype($disp_err, 'string'); // seems to always return string, but be sure
+					$disp_err = strtolower(trim($disp_err));
+					if ($disp_err !== '1' && $disp_err !== 'on' && !self::suppressErrorDisplay()) {
+						// This are always terminiation errors
+						self::showOutput($errtype.' #'.$error_hash, $error['message'], $error['file'], $error['line'], $backtrace, true);
+					}
+					break;
+				default:
+					break;
+			}
+    	}
+	}
+	
+	/**
 	 * Get a unique(ish) hash for a given exception, which merely serves to
 	 * tie together related errors when looking at a whole load of errors
 	 * The returned hash is in two parts: YYYY/ZZZZ where YYYY is only
