diff --git a/core/Debug.php b/core/Debug.php
index 22b5de801..8660aad55 100644
--- a/core/Debug.php
+++ b/core/Debug.php
@@ -57,7 +57,7 @@ class Debug {
$result .= "
$k = " . Debug::text($v) . "\n";
}
$val = $result . "\n";
-
+
} else if (is_object($val)) {
$val = var_export($val, true);
} else {
@@ -69,7 +69,7 @@ class Debug {
return $val;
}
}
-
+
/**
* Show a debugging message
*/
@@ -82,33 +82,35 @@ class Debug {
echo Convert::raw2xml(trim($message)) . "\n";
}
}
-
+
/**
* Load an error handler
*/
static function loadErrorHandlers() {
Debug::loadFatalErrorHandler();
}
-
+
static function loadFatalErrorHandler() {
set_error_handler('errorHandler', E_ALL & ~E_NOTICE);
}
static function warningHandler($errno, $errstr, $errfile, $errline, $errcontext) {
if(self::$send_warnings_to) self::emailError(self::$send_warnings_to, $errno, $errstr, $errfile, $errline, $errcontext, "Warning");
-
+
if(Director::isDev()) {
- self::showError($errno, $errstr, $errfile, $errline, $errcontext);
- die();
+ if(error_reporting() != 0) { // otherwise the error was suppressed with @
+ self::showError($errno, $errstr, $errfile, $errline, $errcontext);
+ die();
+ }
}
}
-
+
static function fatalHandler($errno, $errstr, $errfile, $errline, $errcontext) {
if(self::$send_errors_to) self::emailError(self::$send_errors_to, $errno, $errstr, $errfile, $errline, $errcontext, "Error");
if(Director::isDev()) {
Debug::showError($errno, $errstr, $errfile, $errline, $errcontext);
-
+
} else {
Debug::friendlyError($errno, $errstr, $errfile, $errline, $errcontext);
}
@@ -119,7 +121,7 @@ class Debug {
if(Director::is_ajax()) {
echo "ERROR:There has been an error";
-
+
} else {
if(file_exists('../assets/error-500.html')) {
echo "ERROR:";
@@ -136,27 +138,27 @@ class Debug {
if(Director::is_ajax()) {
echo "ERROR:Error $errno: $errstr\n At l$errline in $errfile\n";
Debug::backtrace();
-
+
} else {
echo "\n";
echo "
FATAL ERROR: $errstr
\n At line $errline in $errfile
\n
\n
\n";
Debug::backtrace();
-
+
echo "
Context
\n";
Debug::show($errcontext);
echo "
\n";
}
}
-
+
static function emailError($emailAddress, $errno, $errstr, $errfile, $errline, $errcontext, $errorType = "Error") {
if(strtolower($errorType) == 'warning') {
$colour = "orange";
} else {
$colour = "red";
}
-
+
$data = "\n";
$data .= "
$errorType: $errstr
At line $errline in $errfile\n
\n
\n
\n";