Fix session lock

Still needs improvment. Shouldn't be static!
This commit is contained in:
Dennis Eichhorn 2016-11-24 15:37:24 +01:00
parent baeb32b51e
commit 7b36dafa57
2 changed files with 7 additions and 10 deletions

View File

@ -85,8 +85,6 @@ class HttpSession implements SessionInterface
$this->sid = session_id();
$this->setCsrfProtection();
self::$isLocked = true;
}
/**
@ -135,7 +133,7 @@ class HttpSession implements SessionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function lock()
public function lock()
{
self::$isLocked = true;
}
@ -158,7 +156,10 @@ class HttpSession implements SessionInterface
*/
public function save()
{
if(!self::$isLocked) {
$_SESSION = $this->sessionData;
session_write_close();
}
}
/**
@ -199,10 +200,7 @@ class HttpSession implements SessionInterface
*/
public function __destruct()
{
if(!self::$isLocked) {
$_SESSION = $this->sessionData;
session_write_close();
}
$this->save();
}
}

View File

@ -93,8 +93,7 @@ abstract class HeaderAbstract
*/
public static function lock()
{
CookieJar::lock();
HttpSession::lock();
// todo: maybe pass session as member and make lock not static
self::$isLocked = true;
}