summaryrefslogtreecommitdiffstats
path: root/lib/private/session/memory.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2014-03-31 21:38:54 +0200
committerBart Visscher <bartv@thisnet.nl>2014-03-31 21:38:54 +0200
commit6b061c236dd5730837b567f2c39a19af1617d33c (patch)
tree27de0d46deae2987ea398f2f2aee4e26786c6f48 /lib/private/session/memory.php
parent8951328a87c16e5ebfe4d3e5c392347db1e54f92 (diff)
parentab696edba685cd6d2a64c2e48907f03197aae53f (diff)
downloadnextcloud-server-6b061c236dd5730837b567f2c39a19af1617d33c.tar.gz
nextcloud-server-6b061c236dd5730837b567f2c39a19af1617d33c.zip
Merge branch 'master' into type-hinting
Conflicts: lib/private/image.php lib/private/l10n.php lib/private/request.php lib/private/share/mailnotifications.php lib/private/template/base.php
Diffstat (limited to 'lib/private/session/memory.php')
-rw-r--r--lib/private/session/memory.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/private/session/memory.php b/lib/private/session/memory.php
index 1b9ac452575..1497c0f8928 100644
--- a/lib/private/session/memory.php
+++ b/lib/private/session/memory.php
@@ -28,6 +28,7 @@ class Memory extends Session {
* @param integer $value
*/
public function set($key, $value) {
+ $this->validateSession();
$this->data[$key] = $value;
}
@@ -54,10 +55,29 @@ class Memory extends Session {
* @param string $key
*/
public function remove($key) {
+ $this->validateSession();
unset($this->data[$key]);
}
public function clear() {
$this->data = array();
}
+
+ /**
+ * Helper function for PHPUnit execution - don't use in non-test code
+ */
+ public function reopen() {
+ $this->sessionClosed = false;
+ }
+
+ /**
+ * In case the session has already been locked an exception will be thrown
+ *
+ * @throws \Exception
+ */
+ private function validateSession() {
+ if ($this->sessionClosed) {
+ throw new \Exception('Session has been closed - no further changes to the session as allowed');
+ }
+ }
}