Skip regenerate if session is not active

This commit is contained in:
Alex Tselegidis 2024-05-22 11:18:22 +02:00
parent 1f17ae6376
commit af2e3a065f

View file

@ -693,6 +693,10 @@ class CI_Session {
*/ */
public function sess_regenerate($destroy = null) public function sess_regenerate($destroy = null)
{ {
if (@session_status() !== PHP_SESSION_ACTIVE) {
return;
}
$destroy = boolval($destroy !== null ? $destroy : config_item('sess_regenerate_destroy')); $destroy = boolval($destroy !== null ? $destroy : config_item('sess_regenerate_destroy'));
$_SESSION['__ci_last_regenerate'] = time(); $_SESSION['__ci_last_regenerate'] = time();
@session_regenerate_id($destroy); @session_regenerate_id($destroy);