Merge pull request #3304 from Shakespeare2000/feature/session
#3073 Fix write() for session_regenerate_id(TRUE)
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 9e74605..efdec40 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -141,12 +141,8 @@
public function write($session_id, $session_data)
{
- if ($this->_lock === FALSE)
- {
- return FALSE;
- }
// Was the ID regenerated?
- elseif ($session_id !== $this->_session_id)
+ if ($session_id !== $this->_session_id)
{
if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id))
{
@@ -156,6 +152,10 @@
$this->_row_exists = FALSE;
$this->_session_id = $session_id;
}
+ elseif ($this->_lock === FALSE)
+ {
+ return FALSE;
+ }
if ($this->_row_exists === FALSE)
{