summaryrefslogtreecommitdiffstats
path: root/console.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-18 22:30:01 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-18 22:30:01 +0200
commitc609abf07522c9e1c90811f01e232488492e45b3 (patch)
tree39267474806655812836cfe4c2bf472686182b3a /console.php
parent51975d360a93daba3b2681136a77b8d7078719e9 (diff)
downloadnextcloud-server-c609abf07522c9e1c90811f01e232488492e45b3.tar.gz
nextcloud-server-c609abf07522c9e1c90811f01e232488492e45b3.zip
In case of fatal php errors and other unhandled exceptions no html error page is expected to be displayed in the console
Diffstat (limited to 'console.php')
-rw-r--r--console.php11
1 files changed, 8 insertions, 3 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);
}