diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 78f90b8ec956..c899459ea8f6 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -68,6 +68,14 @@ public function start() array($this, 'sessionGC') ); + // use to prevent the sessions database from growing endlessly + // if session.gc_probability is on 0 (like Debian system) + if ((int) ini_get('session.gc_probability') <= 0) { + if (rand(1, ini_get('session.gc_divisor') + 1) === 1) { + $this->sessionGC($this->options['lifetime']); + } + } + parent::start(); }