PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_Session » Bug #1077

Session expires before the expected time

Details

Submitted2004-03-26 16:42 UTC
Fromrbaba99 at caramail dot com
Assignedtroehr
StatusClosed
PackageHTTP_Session
PHP Version4.2.2
OSLinux
Roadmaps(Not assigned)

Comments

[2004-03-26 16:42 UTC] rbaba99 at caramail dot com

Description:
------------
HTTP_Session with DB container:

Setting the expire/Idle time with the function HTTP:_Session:setExpire / HTTP:_Session:setIdle to a value grater than the value of session.gc_maxlifetime in php.ini, has no effect on the session expire/Idle because the session will expire when the time is equal to the session.gc_maxlifetime value.

Reproduce code:
---------------
HTTP_Session::SetContainer('DB',$options);
in_set('session.gc_maxlifetime',120); // 2 minutes
HTTP_Session::start();
HTTP_Session::setExpire(time()+10*60); // expires in 10 minutes
HTTP_Session::setIdle(time()+5*60); // Idle = 5 minutes

Expected result:
----------------
Session expires/idles in 10minutes/5minutes

Actual result:
--------------
A session with the above setting will expires if it idles in 2minutes+1second .

[2005-02-24 17:54 UTC] r dot php at instantox dot com

Experienced the same issue here. My current workaround is to set session.gc_maxlifetime to the same timeframe as my expiration.

eg:

$sess_time = 480;
HTTP_Session::SetContainer('DB',$options);
ini_set('session.gc_maxlifetime',$sess_time*60);
HTTP_Session::start();
HTTP_Session::setExpire(time()+ ($sess_time*60));

Although it was confusing at first until I saw that the code was using the default gc_maxlifetime value from php.ini. It seems that the code should check the current session expiration (as set by setExpire??) and subtract that from the current time.

-r

-r

[2005-09-02 21:13 UTC] torsten dot roehr at gmx dot de

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.