From f0e325fda013d2762066997cc961adb2c485f723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Thu, 12 Jun 2014 13:38:08 +0200 Subject: [PATCH] error backtrace improved by only adding a limited string length improved error shutdown message --- application/core/ErrorHandler.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index e0c16a56..e16960a4 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -126,9 +126,11 @@ class ErrorHandler { logMessage('Error-Report failed! ' . print_r($response, true)); } } - if ($this->shouldStopExecution($errorNumber)) { - $this->maniaControl->quit('Stopping Execution...'); + + if ($this->isFatalError($errorNumber)) { + $this->maniaControl->quit('Quitting ManiaControl after Fatal Error.'); } + return false; } @@ -237,7 +239,13 @@ class ErrorHandler { $string .= 'array(' . $this->parseArgumentsArray($arg) . ')'; } else { $type = gettype($arg); - $string .= $type . '(' . print_r($arg, true) . ')'; + $string .= $type . '('; + if (is_string($arg)) { + print_r(substr($arg, 0, 50), true); + } else { + print_r($arg, true); + } + $string .= ')'; } if ($index < $argsCount - 1) { $string .= ', '; @@ -273,12 +281,12 @@ class ErrorHandler { } /** - * Test if ManiaControl should stop its Execution + * Test whether the given Error Number represents a Fatal Error * * @param int $errorNumber * @return bool */ - private function shouldStopExecution($errorNumber) { + private function isFatalError($errorNumber) { return ($errorNumber & E_FATAL); } @@ -371,7 +379,7 @@ class ErrorHandler { if ($this->shouldRestart()) { $this->maniaControl->restart(); } - exit(); + $this->maniaControl->quit('Quitting ManiaControl after Exception.'); } }