The code example provided of my_session_regenerate_id() DOES NOT work and DESTROYS all session variables. Plus the second ini_set gives an error.
The code for regenerating (only that part, the rest seems fine) should simply be this:
<?php
function my_session_regenerate_id() {
$new_session_id = session_create_id();
$keepSession = $_SESSION ;
$_SESSION['new_session_id'] = $new_session_id;
$_SESSION['destroyed'] = time();
session_commit() ;
ini_set('session.use_strict_mode', 0);
session_id($new_session_id);
session_start();
$_SESSION = $keepSession ;
}
?>