diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-20 14:07:15 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-20 14:07:15 +0100 |
commit | 0b1c4bfc3bae1ece32f064d9d96527ece2cfab62 (patch) | |
tree | 4b7238941dfd70f277a9a3d2010dacfd265666ae /lib | |
parent | 7ea5c47b3ca38e71fdca6ff66e06522bfcfbbd40 (diff) | |
parent | 843fef0490493d1c21863fcd339695177542da53 (diff) | |
download | nextcloud-server-0b1c4bfc3bae1ece32f064d9d96527ece2cfab62.tar.gz nextcloud-server-0b1c4bfc3bae1ece32f064d9d96527ece2cfab62.zip |
Merge pull request #15062 from owncloud/fix-15053-master
Handle session initialization errors and display error page
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 1 | ||||
-rw-r--r-- | lib/private/session/internal.php | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php index 00117918c87..da4b3a47c75 100644 --- a/lib/base.php +++ b/lib/base.php @@ -415,6 +415,7 @@ class OC { } // if session cant be started break with http 500 error } catch (Exception $e) { + \OCP\Util::logException('base', $e); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($e); diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php index 8fda6b3b3ee..acd93630f40 100644 --- a/lib/private/session/internal.php +++ b/lib/private/session/internal.php @@ -18,7 +18,9 @@ namespace OC\Session; class Internal extends Session { public function __construct($name) { session_name($name); + set_error_handler(array($this, 'trapError')); session_start(); + restore_error_handler(); if (!isset($_SESSION)) { throw new \Exception('Failed to start session'); } @@ -82,7 +84,11 @@ class Internal extends Session { throw new \Exception('The session cannot be reopened - reopen() is ony to be used in unit testing.'); } - private function validateSession() { + public function trapError($errorNumber, $errorString) { + throw new \ErrorException($errorString); + } + + private function validateSession() { if ($this->sessionClosed) { throw new \Exception('Session has been closed - no further changes to the session as allowed'); } |