X-Git-Url: https://git.mxchange.org/?p=hub.git;a=blobdiff_plain;f=application%2Fhub%2Fexceptions.php;h=8eefa5ea554366f8fac8de19fb38fe3620982521;hp=0ada1c1d2599f9c50765dcfa2f311068fd1e0b4a;hb=f6368b592b8d4082f856002f6550f37bcfeeea83;hpb=cbc79963e60aeeeedc2e054d9beceaf1fd1465ea diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php index 0ada1c1d2..8eefa5ea5 100644 --- a/application/hub/exceptions.php +++ b/application/hub/exceptions.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2014 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify @@ -33,11 +33,14 @@ function hub_exception_handler ($exceptionInstance) { // Init argument string $argsString = ''; - // Convert arguments type into human-readable - foreach ($traceArray['args'] as $arg) { - $argsString .= ', ' . gettype($arg); - } // END - foreach - $argsString = substr($argsString, 2); + // Any arguments? + if ((isset($traceArray['args'])) && (is_array($traceArray['args'])) && (count($traceArray['args']) > 0)) { + // Convert arguments type into human-readable + foreach ($traceArray['args'] as $arg) { + $argsString .= ', ' . gettype($arg); + } // END - foreach + $argsString = substr($argsString, 2); + } // END - if // Set missing file/line if (!isset($traceArray['file'])) $traceArray['file'] = 'unknown'; @@ -84,9 +87,11 @@ Backtrace: // Output the message print($message); } else { - // Invalid exception instance detected! Do *only* throw exceptions that - // extends our own exception 'FrameworkException' to get such nice - // outputs like above. + /* + * Invalid exception instance detected! Do *only* throw exceptions that + * extends our own exception 'FrameworkException' to get such nice + * outputs like above. + */ print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.'); } } @@ -120,7 +125,7 @@ function __assertHandler ($file, $line, $code) { ); // Log assert - die($message); + die($message . PHP_EOL); syslog(LOG_WARNING, $message); // Throw an exception here