Created
July 24, 2014 12:03
-
-
Save brendo/187fb680793f7c9d60ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/symphony/lib/core/class.databasesessionhandler.php b/symphony/lib/core/class.databasesessionhandler.php | |
index 5a4d517..6d480a5 100644 | |
--- a/symphony/lib/core/class.databasesessionhandler.php | |
+++ b/symphony/lib/core/class.databasesessionhandler.php | |
@@ -88,7 +88,7 @@ class DatabaseSessionHandler implements SessionHandlerInterface | |
"DELETE | |
FROM `tbl_sessions` | |
WHERE `session` = '%s'", | |
- $this->database->cleanValue($session_id) | |
+ $this->database->cleanValue($key) | |
)); | |
} | |
@@ -144,7 +144,7 @@ class DatabaseSessionHandler implements SessionHandlerInterface | |
FROM `tbl_sessions` | |
WHERE `session` = '%s' | |
LIMIT 1", | |
- $this->database->cleanValue($session_id) | |
+ $this->database->cleanValue($key) | |
) | |
); | |
@@ -174,8 +174,9 @@ class DatabaseSessionHandler implements SessionHandlerInterface | |
public function write($session_id, $session_data) | |
{ | |
$key = $this->key($session_id); | |
+ $data = $this->read($session_id); | |
- if (!isset($this->statuses[$key]) || (isset($this->statuses[$key]) && $this->statuses[$key] != md5($session_data))) { | |
+ if(!is_null($data) || $this->statuses[$key] !== md5($session_data)) { | |
$data = array( | |
'session' => $key, | |
'session_expires' => time(), | |
diff --git a/symphony/lib/core/class.session.php b/symphony/lib/core/class.session.php | |
index 9636830..e916f59 100644 | |
--- a/symphony/lib/core/class.session.php | |
+++ b/symphony/lib/core/class.session.php | |
@@ -50,11 +50,11 @@ class Session extends Container | |
'session_cookie_httponly' => false | |
], $settings); | |
- if (empty($this->settings['domain'])) { | |
- $this->settings['domain'] = $this->getDomain(); | |
+ if (empty($this->settings['session_cookie_domain'])) { | |
+ $this->settings['session_cookie_domain'] = $this->getDomain(); | |
} | |
- $this->key = $key; | |
+ $this->key = $this->settings['session_name']; | |
} | |
/** | |
@@ -75,14 +75,7 @@ class Session extends Container | |
} | |
if (!is_null($this->handler)) { | |
- session_set_save_handler( | |
- array($this->handler, 'open'), | |
- array($this->handler, 'close'), | |
- array($this->handler, 'read'), | |
- array($this->handler, 'write'), | |
- array($this->handler, 'destroy'), | |
- array($this->handler, 'gc') | |
- ); | |
+ session_set_save_handler($this->handler, true); | |
} | |
session_name($this->settings['session_name']); | |
@@ -189,10 +182,6 @@ class Session extends Container | |
*/ | |
public function offsetGet($key) | |
{ | |
- if (!isset($this->keys[$key])) { | |
- return null; | |
- } | |
- | |
return $this->store[$this->key][$key]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment