X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fexceptions%2Fclass_FrameworkException.php;h=c5ccc0aec023b6e41a039a88858777140187be3f;hb=e51607c0f33062258ba0a07b79b8e1f34fd6b832;hp=f2f6080c82cd4eeee890cfb09c3a964b679608a0;hpb=361e6320e50a8bb1a3ccb675388b8042361669ae;p=core.git diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php index f2f6080c..c5ccc0ae 100644 --- a/inc/classes/exceptions/class_FrameworkException.php +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -6,7 +6,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007 - 2009 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -32,7 +32,7 @@ abstract class FrameworkException extends ReflectionException { /** * Extra data */ - private $extraData = ""; + private $extraData = ''; /** * The super constructor for all exceptions @@ -41,7 +41,10 @@ abstract class FrameworkException extends ReflectionException { * @param $code An optional code for better debugging * @return void */ - public function __construct($message, $code = 0) { + public function __construct ($message, $code = 0) { + // Make sure everything is assigned properly + parent::__construct($message, $code); + // Extract backtrace $this->saveBackTrace(); @@ -61,11 +64,9 @@ abstract class FrameworkException extends ReflectionException { // End here exit(); } // END - if - // Make sure everything is assigned properly - parent::__construct($message, $code); - // Log it away if DEBUG_ALL is set - if (defined('DEBUG_ALL')) { + // Should we log exceptions? (bad implementation) + if (defined('LOG_EXCEPTIONS')) { // Log the error error_log(sprintf("[%s:] %s (%s)", $this->__toString(), @@ -113,42 +114,46 @@ abstract class FrameworkException extends ReflectionException { $dbgMsg = "
\nDebug backtrace begin:
\n"; foreach ($dbgTrace as $dbgIndex => $dbgInfo) { // No info by default - $info = "NULL"; + $info = 'NULL'; // Are there arguments? if ((isset($dbgInfo['args'])) && (is_array($dbgInfo['args'])) && (isset($dbgInfo['args'][0]))) { //* DEBUG: */ echo $dbgIndex.":
".htmlentities(print_r($dbgInfo['args'], true))."
"; - $info = ""; + $info = ''; foreach ($dbgInfo['args'] as $debug) { // Add only non-array elements if (!is_array($debug)) { - $info .= $debug.", "; + $info .= $debug . ', '; } // END - if - } // END - if + } // END - foreach + // Remove last chars (commata, space) $info = substr($info, 0, -2); } // END - if // Prepare argument infos - $info = "{$info}"; + $info = '' . $info . ''; // File detection - $file = "Unknown file"; + $file = 'Unknown file'; if (isset($dbgInfo['file'])) { $file = basename($dbgInfo['file']); } // END - if // Line detection - $line = "Unknown line"; + $line = 'Unknown line'; if (isset($dbgInfo['line'])) { - $line = "line {$dbgInfo['line']}"; + $line = 'line ' . $dbgInfo['line']; } // END - if // The message - $dbgMsg .= "\t at ".$dbgIndex." ".$file." (".$line.") -> ".$dbgInfo['function']."(".$info.")
\n"; + $dbgMsg .= "\t at ".$dbgIndex." ".$file." (".$line.") -> ".$dbgInfo['function'].'('.$info.")
\n"; } // END - if + + // Add end-message $dbgMsg .= "Debug backtrace end
\n"; + // Return full debug message return $dbgMsg; }