mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Merge pull request #4495 from nextcloud/downstream-27638
Catch session already closed exception in destructor
This commit is contained in:
commit
c59652dbc3
2 changed files with 7 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue