summaryrefslogtreecommitdiffstats
path: root/lib/private/Session/Internal.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Session/Internal.php')
-rw-r--r--lib/private/Session/Internal.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php
index 6e0c54c6fab..f192b20cc95 100644
--- a/lib/private/Session/Internal.php
+++ b/lib/private/Session/Internal.php
@@ -68,8 +68,11 @@ class Internal extends Session {
* @param integer $value
*/
public function set(string $key, $value) {
- $this->validateSession();
+ $reopened = $this->reopen();
$_SESSION[$key] = $value;
+ if ($reopened) {
+ $this->close();
+ }
}
/**
@@ -101,6 +104,7 @@ class Internal extends Session {
}
public function clear() {
+ $this->reopen();
$this->invoke('session_unset');
$this->regenerateId();
$this->startSession(true);
@@ -120,6 +124,7 @@ class Internal extends Session {
* @return void
*/
public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) {
+ $this->reopen();
$oldId = null;
if ($updateToken) {
@@ -171,8 +176,14 @@ class Internal extends Session {
/**
* @throws \Exception
*/
- public function reopen() {
- throw new \Exception('The session cannot be reopened - reopen() is only to be used in unit testing.');
+ public function reopen(): bool {
+ if ($this->sessionClosed) {
+ $this->startSession();
+ $this->sessionClosed = false;
+ return true;
+ }
+
+ return false;
}
/**