Hey Rick, after some research I found that the when you set the php’s session life time to 0, it’s dies after the browser is closed. (php site http://ar2.php.net/manual/en/function.setcookie.php). After debuged my cookie I’ve founded that was setted to 0 on the client also.
So we could have the same in codeigniter, it’s a small change.
At Session.php
<?php
//At method
function sess_run() {
...
...
//next is line 101
if (is_numeric($expiration))
{
if ($expiration > 0)
{
$this->sess_length = $this->CI->config->item('sess_expiration');
}
else if ($expiration == 0)
{
$this->sess_length = 0
}
else if ($expiration == -1)
{
$this->sess_length = (60*60*24*365*2);
}
}
...
...
}
//And at method
function sess_write() {
...
...
// At line 275
setcookie(
$this->sess_cookie,
$cookie_data,
($this->sess_length == 0) ? 0 : $this->sess_length + time(),
$this->CI->config->item('cookie_path'),
$this->CI->config->item('cookie_domain'),
0
);
...
...
}
?>
After this changes:
- sess_expiration = 0 it will timeout after browser closes
- sess_expiration = -1 it will receive the default 2 years value.
Hope you can add this.
