From 1914939094a473b8f5061f2e1eaf1bcf20a27b5c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 27 Dec 2015 18:45:35 +0100 Subject: [PATCH] Moving session save into the destructor. Save not possible after sending headers --- DataStorage/Session/HttpSession.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/DataStorage/Session/HttpSession.php b/DataStorage/Session/HttpSession.php index d27a40f44..b3b8288ea 100644 --- a/DataStorage/Session/HttpSession.php +++ b/DataStorage/Session/HttpSession.php @@ -62,7 +62,7 @@ class HttpSession implements SessionInterface $_SESSION = null; $this->sid = session_id(); - session_write_close(); + $this->set('UID', 0, false); if(($CSRF = $this->get('CSRF')) === null) { $CSRF = StringUtils::generateString(10, 16); @@ -99,10 +99,7 @@ class HttpSession implements SessionInterface */ public function save() { - session_id($this->sid); - session_start(); - $_SESSION = $this->sessionData; - session_write_close(); + } /** @@ -135,4 +132,10 @@ class HttpSession implements SessionInterface $this->sid = $sid; } + public function __destruct() + { + $_SESSION = $this->sessionData; + session_write_close(); + } + }