Update to CodeIgniter 3.19
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2018, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,7 +29,7 @@
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
@@ -109,7 +109,10 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
}
|
||||
|
||||
// Note: BC work-around for the old 'sess_table_name' setting, should be removed in the future.
|
||||
isset($this->_config['save_path']) OR $this->_config['save_path'] = config_item('sess_table_name');
|
||||
if ( ! isset($this->_config['save_path']) && ($this->_config['save_path'] = config_item('sess_table_name')))
|
||||
{
|
||||
log_message('debug', 'Session: "sess_save_path" is empty; using BC fallback to "sess_table_name".');
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -130,6 +133,8 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
return $this->_fail();
|
||||
}
|
||||
|
||||
$this->php5_validate_id();
|
||||
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
@@ -206,7 +211,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
$this->_db->reset_query();
|
||||
|
||||
// Was the ID regenerated?
|
||||
if ($session_id !== $this->_session_id)
|
||||
if (isset($this->_session_id) && $session_id !== $this->_session_id)
|
||||
{
|
||||
if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id))
|
||||
{
|
||||
@@ -337,6 +342,30 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
: $this->_fail();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate ID
|
||||
*
|
||||
* Checks whether a session ID record exists server-side,
|
||||
* to enforce session.use_strict_mode.
|
||||
*
|
||||
* @param string $id
|
||||
* @return bool
|
||||
*/
|
||||
public function validateId($id)
|
||||
{
|
||||
// Prevent previous QB calls from messing with our queries
|
||||
$this->_db->reset_query();
|
||||
|
||||
$this->_db->select('1')->from($this->_config['save_path'])->where('id', $id);
|
||||
empty($this->_config['match_ip']) OR $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']);
|
||||
$result = $this->_db->get();
|
||||
empty($result) OR $result = $result->row();
|
||||
|
||||
return ! empty($result);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -351,7 +380,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
{
|
||||
if ($this->_platform === 'mysql')
|
||||
{
|
||||
$arg = $session_id.($this->_config['match_ip'] ? '_'.$_SERVER['REMOTE_ADDR'] : '');
|
||||
$arg = md5($session_id.($this->_config['match_ip'] ? '_'.$_SERVER['REMOTE_ADDR'] : ''));
|
||||
if ($this->_db->query("SELECT GET_LOCK('".$arg."', 300) AS ci_session_lock")->row()->ci_session_lock)
|
||||
{
|
||||
$this->_lock = $arg;
|
||||
@@ -414,4 +443,4 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
|
||||
|
||||
return parent::_release_lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user