summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php12
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 13 insertions, 0 deletions
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index f2adacb6b..8c4555481 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -147,6 +147,9 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
{
if ($this->_get_lock($session_id) !== FALSE)
{
+ // Prevent previous QB calls from messing with our queries
+ $this->_db->reset_query();
+
// Needed by write() to detect session_regenerate_id() calls
$this->_session_id = $session_id;
@@ -199,6 +202,9 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
*/
public function write($session_id, $session_data)
{
+ // Prevent previous QB calls from messing with our queries
+ $this->_db->reset_query();
+
// Was the ID regenerated?
if ($session_id !== $this->_session_id)
{
@@ -287,6 +293,9 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
{
if ($this->_lock)
{
+ // Prevent previous QB calls from messing with our queries
+ $this->_db->reset_query();
+
$this->_db->where('id', $session_id);
if ($this->_config['match_ip'])
{
@@ -320,6 +329,9 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
*/
public function gc($maxlifetime)
{
+ // Prevent previous QB calls from messing with our queries
+ $this->_db->reset_query();
+
return ($this->_db->delete($this->_config['save_path'], 'timestamp < '.(time() - $maxlifetime)))
? $this->_success
: $this->_failure;
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 89d6a3a3a..8b0fb677a 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -40,6 +40,7 @@ Bug fixes for 3.0.4
- Fixed a bug (#4362) - :doc:`Session Library <libraries/sessions>` doesn't properly maintain its state after ID regeneration with the 'redis' and 'memcached' drivers on PHP 7.
- Fixed a bug (#4349) - :doc:`Database <database/index>` drivers 'mysql', 'mysqli', 'pdo/mysql' discard other ``sql_mode`` flags when "stricton" is enabled.
- Fixed a bug (#4349) - :doc:`Database <database/index>` drivers 'mysql', 'mysqli', 'pdo/mysql' don't turn off ``STRICT_TRANS_TABLES`` on MySQL 5.7+ when "stricton" is disabled.
+- Fixed a bug (#4374) - :doc:`Session Library <libraries/sessions>` with the 'database' driver could be affected by userspace :doc:`Query Builder <database/query_builder>` conditions.
Version 3.0.3
=============