Skip to content

Commit

Permalink
Remove onShutdown error handler
Browse files Browse the repository at this point in the history
It was causing an additional DBALException when there is no DB
connection. The logger was trying to access to the DB during the
shutdown process, causing an unhandled exception to appear in apache
  • Loading branch information
jvillafanez committed Nov 28, 2019
1 parent 9111ba0 commit faddb89
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/private/Log/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,13 @@ public static function register($debug=false) {
} else {
\set_error_handler([$handler, 'onError']);
}
\OC::$server->getShutdownHandler()->register(function () use ($handler) {
$handler->onShutdown();
});
\set_exception_handler([$handler, 'onException']);
}

public static function setLogger(ILogger $logger) {
self::$logger = $logger;
}

//Fatal errors handler
public static function onShutdown() {
$error = \error_get_last();
if ($error && self::$logger) {
//ob_end_clean();
$msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line'];
self::$logger->critical(self::removePassword($msg), ['app' => 'PHP']);
}
}

/**
* Uncaught exception handler
*
Expand Down

0 comments on commit faddb89

Please sign in to comment.