Catch session already closed exception in destructor

pull/4495/head
Victor Dubiniuk 8 years ago committed by Joas Schilling
parent 8ef25a7628
commit 131df248ef
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
  1. 7
      lib/private/Session/CryptoSessionData.php
  2. 2
      lib/private/Session/Internal.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() {

@ -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…
Cancel
Save