summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-04-25 22:24:50 +0200
committerGitHub <noreply@github.com>2017-04-25 22:24:50 +0200
commitc59652dbc34d596d241ff9379930dba660ca4350 (patch)
treee9ec5ef4d84f3d5b6fd2e4d434292e1e4dfe8b66 /lib
parentdb94b5d4af711f6e18aac0c9d4b0357a3b9123d1 (diff)
parent131df248ef29f2dd1d78a1dd43b1fe09a65b3a48 (diff)
downloadnextcloud-server-c59652dbc34d596d241ff9379930dba660ca4350.tar.gz
nextcloud-server-c59652dbc34d596d241ff9379930dba660ca4350.zip
Merge pull request #4495 from nextcloud/downstream-27638
Catch session already closed exception in destructor
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Session/CryptoSessionData.php7
-rw-r--r--lib/private/Session/Internal.php2
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php
index 4e0b852cb35..31fcea4a7a6 100644
--- a/lib/private/Session/CryptoSessionData.php
+++ b/lib/private/Session/CryptoSessionData.php
@@ -64,7 +64,12 @@ class CryptoSessionData implements \ArrayAccess, ISession {
* Close session if class gets destructed
*/
public function __destruct() {
- $this->close();
+ try {
+ $this->close();
+ } catch (SessionNotAvailableException $e){
+ // This exception can occur if session is already closed
+ // So it is safe to ignore it and let the garbage collector to proceed
+ }
}
protected function initializeSession() {
diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php
index 22878154c05..72af5727a54 100644
--- a/lib/private/Session/Internal.php
+++ b/lib/private/Session/Internal.php
@@ -151,7 +151,7 @@ class Internal extends Session {
*/
private function validateSession() {
if ($this->sessionClosed) {
- throw new \Exception('Session has been closed - no further changes to the session are allowed');
+ throw new SessionNotAvailableException('Session has been closed - no further changes to the session are allowed');
}
}
}