summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-06-03 14:33:51 +0200
committerAndrey Andreev <narf@devilix.net>2014-06-03 14:33:51 +0200
commit5995e08ed0d5cf89747911443be06a26e410154f (patch)
tree4fc531829b84574de7626758579f3e04e085fa45 /system/libraries/Session
parenta2cf6fa103b7c949138a7fd6917d60ff8ff67af8 (diff)
#3073: Fix an undefined variable error
Diffstat (limited to 'system/libraries/Session')
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index 4acbcf6c5..f95edcf2c 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -187,19 +187,22 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
rewind($this->_file_handle);
}
- for ($written = 0, $length = strlen($session_data); $written < $length; $written += $result)
+ if (($length = strlen($session_data)) > 0)
{
- if (($result = fwrite($this->_file_handle, substr($session_data, $written))) === FALSE)
+ for ($written = 0; $written < $length; $written += $result)
{
- break;
+ if (($result = fwrite($this->_file_handle, substr($session_data, $written))) === FALSE)
+ {
+ break;
+ }
}
- }
- if ( ! is_int($result))
- {
- $this->_fingerprint = md5(substr($session_data, 0, $written));
- log_message('error', 'Session: Unable to write data.');
- return FALSE;
+ if ( ! is_int($result))
+ {
+ $this->_fingerprint = md5(substr($session_data, 0, $written));
+ log_message('error', 'Session: Unable to write data.');
+ return FALSE;
+ }
}
$this->_fingerprint = md5($session_data);