Skip to content
Permalink
Browse files

Set session.gc_maxlifetime by default.

In the default case of using files for sessions, files could
be garbage collected earlier than expected based on other session
settings.  Always set session.gc_maxlifetime so session files are
garbage collected correctly.

Fixes #2901
  • Loading branch information...
markstory committed May 24, 2012
1 parent aa85451 commit b27a3aab7b1c416c3c9f3472dea6b14bb5156983
@@ -470,6 +470,9 @@ protected static function _configureSession() {
if (!empty($sessionConfig['handler'])) {
$sessionConfig['ini']['session.save_handler'] = 'user';
}
if (!isset($sessionConfig['ini']['session.gc_maxlifetime'])) {
$sessionConfig['ini']['session.gc_maxlifetime'] = $sessionConfig['timeout'] * 60;
}
if (empty($_SESSION)) {
if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) {
@@ -715,6 +715,8 @@ public function testCookieTimeoutFallback() {
TestCakeSession::start();
$this->assertEquals(400, Configure::read('Session.cookieTimeout'));
$this->assertEquals(400, Configure::read('Session.timeout'));
$this->assertEquals(400 * 60, ini_get('session.cookie_lifetime'));
$this->assertEquals(400 * 60, ini_get('session.gc_maxlifetime'));
$_SESSION = null;
Configure::write('Session', array(

0 comments on commit b27a3aa

Please sign in to comment.
You can’t perform that action at this time.