summaryrefslogtreecommitdiffstats
path: root/lib/private/session
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-03-20 12:21:03 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-03-20 12:21:03 +0100
commit843fef0490493d1c21863fcd339695177542da53 (patch)
tree69fe7a9235d3c751dc3153fac6cf993ee012818a /lib/private/session
parenta87cc90d1e7380a58bc4a60bd4cc1894ec41c33b (diff)
downloadnextcloud-server-843fef0490493d1c21863fcd339695177542da53.tar.gz
nextcloud-server-843fef0490493d1c21863fcd339695177542da53.zip
Handle session initialization errors and display error page - fixes #15053
Diffstat (limited to 'lib/private/session')
-rw-r--r--lib/private/session/internal.php8
1 files changed, 7 insertions, 1 deletions
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');
}