Skip to content
Snippets Groups Projects
Commit 2365afb9 authored by Peter Rotich's avatar Peter Rotich
Browse files

Session: Create SessionData object on demand

Session backend issues update via write on new session which caused
assertion to fail.
parent ac8dfa2d
No related branches found
No related tags found
No related merge requests found
...@@ -174,6 +174,8 @@ extends VerySimpleModel { ...@@ -174,6 +174,8 @@ extends VerySimpleModel {
class DbSessionBackend class DbSessionBackend
extends SessionBackend { extends SessionBackend {
var $data = null;
function read($id) { function read($id) {
try { try {
$this->data = SessionData::objects()->filter([ $this->data = SessionData::objects()->filter([
...@@ -200,7 +202,9 @@ extends SessionBackend { ...@@ -200,7 +202,9 @@ extends SessionBackend {
$ttl = $this && method_exists($this, 'getTTL') $ttl = $this && method_exists($this, 'getTTL')
? $this->getTTL() : SESSION_TTL; ? $this->getTTL() : SESSION_TTL;
assert($this->data->session_id == $id); // Create a session data obj if not loaded.
if (!isset($this->data))
$this->data = new SessionData(['session_id' => $id]);
$this->data->session_data = $data; $this->data->session_data = $data;
$this->data->session_expire = $this->data->session_expire =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment