diff options
Diffstat (limited to 'lib/private/session/internal.php')
-rw-r--r-- | lib/private/session/internal.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php index 0b6152acf12..8be3356c6db 100644 --- a/lib/private/session/internal.php +++ b/lib/private/session/internal.php @@ -89,10 +89,9 @@ class Internal extends Session { } } - public function clear() { session_unset(); - @session_regenerate_id(true); + $this->regenerateId(); @session_start(); $_SESSION = array(); } @@ -102,14 +101,35 @@ class Internal extends Session { parent::close(); } - public function reopen() { - throw new \Exception('The session cannot be reopened - reopen() is ony to be used in unit testing.'); - } + /** + * Wrapper around session_regenerate_id + * + * @param bool $deleteOldSession Whether to delete the old associated session file or not. + * @return void + */ + public function regenerateId($deleteOldSession = true) { + @session_regenerate_id($deleteOldSession); + } + + /** + * @throws \Exception + */ + public function reopen() { + throw new \Exception('The session cannot be reopened - reopen() is ony to be used in unit testing.'); + } + /** + * @param int $errorNumber + * @param string $errorString + * @throws \ErrorException + */ public function trapError($errorNumber, $errorString) { throw new \ErrorException($errorString); } + /** + * @throws \Exception + */ private function validateSession() { if ($this->sessionClosed) { throw new \Exception('Session has been closed - no further changes to the session are allowed'); |