Part of the EllisLab Network
   
 
Sessions
Posted: 19 October 2006 07:16 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  144
Joined  09-08-2006

this one got me stuck for a little while smile

my dev box timezone is AEST.

if you change the timezone_reference in config to GMT CI sessions will now longer work.

function sess_run()
{
...
if (
strtolower($this->object->config->item('time_reference')) == 'gmt')
{
    $now
= time();
    
$this->now = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));   
    
    if (
strlen($this->now) < 10)
    
{
        $this
->now = time();
        
log_message('error', 'The session class could not set a proper GMT timestamp so the local time() value was used.');
    
}
}
else
{
    $this
->now = time();
}
...

function sess_write()
{                                
...
    
setcookie(
            
$this->sess_cookie,
            
$cookie_data,
            
$this->sess_length + $this->now,
            
$this->object->config->item('cookie_path'),
            
$this->object->config->item('cookie_domain'),
            
0
        
);

so with timezone set to GMT the $this->now uses GMT time which always keeps the cookie expired.

maybe $this->now should always use time() ?

Profile
 
 
Posted: 23 October 2006 05:30 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  7
Joined  04-24-2006

hi,

you’re right, I had the same problem and fixed it by using time() instead of $this->now in the sess_write function:

setcookie(
    
$this->sess_cookie,
    
$cookie_data,
    
$this->sess_length + time(),
    
$this->object->config->item('cookie_path'),
    
$this->object->config->item('cookie_domain'),
    
0
);

(reported the bug quite some time ago but was probably overlooked by Rick and deleted with all the old bug reports)

Profile
 
 
Posted: 23 October 2006 04:46 PM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  2541
Joined  12-21-2001

OK, thanks.  I missed it last time.

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64455 Total Logged-in Users: 26
Total Topics: 80962 Total Anonymous Users: 1
Total Replies: 435698 Total Guests: 188
Total Posts: 516660    
Members ( View Memberlist )