summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--console.php11
-rw-r--r--lib/base.php11
-rw-r--r--lib/private/log/errorhandler.php3
3 files changed, 14 insertions, 11 deletions
diff --git a/console.php b/console.php
index fc571b03f1e..9d2271db9f2 100644
--- a/console.php
+++ b/console.php
@@ -42,6 +42,11 @@ if (version_compare(PHP_VERSION, '5.4.0') === -1) {
return;
}
+function exceptionHandler($exception) {
+ echo "An unhandled exception has been thrown:" . PHP_EOL;
+ echo $exception;
+ exit(1);
+}
try {
require_once 'lib/base.php';
@@ -53,6 +58,8 @@ try {
exit(0);
}
+ set_exception_handler('exceptionHandler');
+
if (!OC_Util::runningOnWindows()) {
if (!function_exists('posix_getuid')) {
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
@@ -87,7 +94,5 @@ try {
$application->loadCommands(new ArgvInput(), new ConsoleOutput());
$application->run();
} catch (Exception $ex) {
- echo "An unhandled exception has been thrown:" . PHP_EOL;
- echo $ex;
- exit(1);
+ exceptionHandler($ex);
}
diff --git a/lib/base.php b/lib/base.php
index 26be1161ba3..8ea164a5007 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -545,14 +545,9 @@ class OC {
OC_Util::isSetLocaleWorking();
if (!defined('PHPUNIT_RUN')) {
- $logger = \OC::$server->getLogger();
- OC\Log\ErrorHandler::setLogger($logger);
- if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
- OC\Log\ErrorHandler::register(true);
- set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
- } else {
- OC\Log\ErrorHandler::register();
- }
+ OC\Log\ErrorHandler::setLogger(\OC::$server->getLogger());
+ $debug = \OC::$server->getConfig()->getSystemValue('debug', false);
+ OC\Log\ErrorHandler::register($debug);
}
// register the stream wrappers
diff --git a/lib/private/log/errorhandler.php b/lib/private/log/errorhandler.php
index 27cde4aa242..8899bcfcb03 100644
--- a/lib/private/log/errorhandler.php
+++ b/lib/private/log/errorhandler.php
@@ -44,6 +44,9 @@ class ErrorHandler {
if ($debug) {
set_error_handler(array($handler, 'onAll'), E_ALL);
+ if (\OC::$CLI) {
+ set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
+ }
} else {
set_error_handler(array($handler, 'onError'));
}
>204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302