diff --git a/application/src/Mvc/MvcListeners.php b/application/src/Mvc/MvcListeners.php index 4d6cc00e0..f9a92280e 100644 --- a/application/src/Mvc/MvcListeners.php +++ b/application/src/Mvc/MvcListeners.php @@ -92,6 +92,13 @@ public function bootstrapSession(MvcEvent $event) 'use_only_cookies' => true, 'gc_maxlifetime' => 1209600, ]; + + // Override PHP defaults that configure for no GC + if (empty($config['session']['allow_no_gc']) && ini_get('session.gc_probability') == 0) { + $defaultOptions['gc_probability'] = 1; + $defaultOptions['gc_divisor'] = 1000; + } + $userOptions = $config['session']['config'] ?? []; $sessionConfig->setOptions(array_merge($defaultOptions, $userOptions));