summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Session/drivers')
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php2
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php12
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php2
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php2
4 files changed, 12 insertions, 6 deletions
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 0ec6e34f0..20cec00fd 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -252,7 +252,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
*
* Releases locks
*
- * @return void
+ * @return bool
*/
public function close()
{
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index ad8315d52..5852277e8 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -107,7 +107,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
* Sanitizes the save_path directory.
*
* @param string $save_path Path to session files' directory
- * @param string $name Session cookie name, unused
+ * @param string $name Session cookie name
* @return bool
*/
public function open($save_path, $name)
@@ -269,7 +269,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
*
* Releases locks and closes file descriptor.
*
- * @return void
+ * @return bool
*/
public function close()
{
@@ -332,10 +332,16 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
$ts = time() - $maxlifetime;
+ $pattern = sprintf(
+ '/^%s[0-9a-f]{%d}$/',
+ preg_quote($this->_config['cookie_name'], '/'),
+ ($this->_config['match_ip'] === TRUE ? 72 : 40)
+ );
+
foreach ($files as $file)
{
// If the filename doesn't match this pattern, it's either not a session file or is not ours
- if ( ! preg_match('/(?:[0-9a-f]{32})?[0-9a-f]{40}$/i', $file)
+ if ( ! preg_match($pattern, $file)
OR ! is_file($this->_config['save_path'].DIRECTORY_SEPARATOR.$file)
OR ($mtime = filemtime($this->_config['save_path'].DIRECTORY_SEPARATOR.$file)) === FALSE
OR $mtime > $ts)
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 00112c88c..600b8ca66 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -229,7 +229,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
*
* Releases locks and closes connection.
*
- * @return void
+ * @return bool
*/
public function close()
{
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index c53975ae4..c3c75b3b6 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -230,7 +230,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
*
* Releases locks and closes connection.
*
- * @return void
+ * @return bool
*/
public function close()
{