Skip to content

Commit 0f6bdd8

Browse files
author
Sergey Matvienko
committed
Fix for Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time
1 parent 80ff0d2 commit 0f6bdd8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/config/config/factories.yml

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ default:
3838
class: sfSessionStorage
3939
param:
4040
session_name: symfony
41+
timeout: 1800
4142

4243
view_cache_manager:
4344
class: sfViewCacheManager

lib/storage/sfSessionStorage.class.php

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ public function initialize($options = null)
9090
session_cache_limiter($this->options['session_cache_limiter']);
9191
}
9292

93+
// force the max lifetime for session garbage collector to be greater than timeout
94+
if (ini_get('session.gc_maxlifetime') < $this->options['timeout'])
95+
{
96+
ini_set('session.gc_maxlifetime', $this->options['timeout']);
97+
}
98+
9399
if ($this->options['auto_start'] && !self::$sessionStarted)
94100
{
95101
session_start();

lib/user/sfBasicSecurityUser.class.php

-6
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,6 @@ public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $o
251251
$this->options['timeout'] = 1800;
252252
}
253253

254-
// force the max lifetime for session garbage collector to be greater than timeout
255-
if (ini_get('session.gc_maxlifetime') < $this->options['timeout'])
256-
{
257-
ini_set('session.gc_maxlifetime', $this->options['timeout']);
258-
}
259-
260254
// read data from storage
261255
$this->authenticated = $storage->read(self::AUTH_NAMESPACE);
262256
$this->credentials = $storage->read(self::CREDENTIAL_NAMESPACE);

0 commit comments

Comments
 (0)