Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-11-07 18:28:06 +0300
committerGitHub <noreply@github.com>2017-11-07 18:28:06 +0300
commit469db9fbb9dd20a6cbab6fe21afabca93019cde8 (patch)
tree830d5fd46080d9fc97634b4e63c1e292bbbd4f2f /index.php
parentf55732a18facfe52167e346a8aa40cfc66707fa0 (diff)
parent68dbf94470fbfbe9d10d29675b2ba9985c5ead6f (diff)
Merge pull request #7073 from nextcloud/no-whitepage-of-death
Show proper error page even if the config.php has syntax errors
Diffstat (limited to 'index.php')
-rw-r--r--index.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/index.php b/index.php
index a3e1ff57192..abe30d48aba 100644
--- a/index.php
+++ b/index.php
@@ -70,7 +70,29 @@ try {
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
} catch (Error $ex) {
- \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
+ try {
+ \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
+ } catch (Error $e) {
+
+ $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
+ $validProtocols = [
+ 'HTTP/1.0',
+ 'HTTP/1.1',
+ 'HTTP/2',
+ ];
+ $protocol = 'HTTP/1.1';
+ if(in_array($claimedProtocol, $validProtocols, true)) {
+ $protocol = $claimedProtocol;
+ }
+ header($protocol . ' 500 Internal Server Error');
+ header('Content-Type: text/plain; charset=utf-8');
+ print("Internal Server Error\n\n");
+ print("The server encountered an internal error and was unable to complete your request.\n");
+ print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
+ print("More details can be found in the webserver log.\n");
+
+ throw $e;
+ }
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}