From 0dcbeeb72cdab4f2aa33be7dcd3c2bb868f933d1 Mon Sep 17 00:00:00 2001 From: stealth35 Date: Wed, 25 May 2011 17:07:33 +0200 Subject: [PATCH 1/3] [PdoSessionStorage] manual activation of GC if probability is on 0 --- .../HttpFoundation/SessionStorage/PdoSessionStorage.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 78f90b8ec956..5fe99bbf59a4 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(); } From 00feb13d5e2c8ef19f7c76a4203d689376ac322d Mon Sep 17 00:00:00 2001 From: stealth35 Date: Wed, 25 May 2011 08:23:13 -0700 Subject: [PATCH 2/3] fix space --- .../HttpFoundation/SessionStorage/PdoSessionStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 5fe99bbf59a4..59efabbc3bad 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -70,7 +70,7 @@ public function start() // 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 ((int) ini_get('session.gc_probability') == 0) { if (rand(1, ini_get('session.gc_divisor') + 1) === 1) { $this->sessionGC($this->options['lifetime']); } From 4fa3856771d4ec3ee0ec5f81bcc6e4848f3b51ba Mon Sep 17 00:00:00 2001 From: stealth35 Date: Wed, 25 May 2011 08:29:15 -0700 Subject: [PATCH 3/3] change sign --- .../HttpFoundation/SessionStorage/PdoSessionStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 59efabbc3bad..c899459ea8f6 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -70,7 +70,7 @@ public function start() // 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 ((int) ini_get('session.gc_probability') <= 0) { if (rand(1, ini_get('session.gc_divisor') + 1) === 1) { $this->sessionGC($this->options['lifetime']); }