I have a form with multiple pages. I use the $_SESSION
array to store the user input. Each page starts with
session_start();
Sometimes the $_SESSION
variables are lost. I guess this is happens if the user remains for a too long period afk and the Garbage Collector removes then the variables.
If I understand it correctly, then the function session_status() only checks if a session has been started, and not if the garbage collector has removed recently any entries.
If the garbage collector becomes active, does he delete all entries of the $_SESSION
array or just some of them? In other words, could I check if my Session expired by simply doing the following:
session_start();
if(empty($_SESSION)){
// Garbage Collecter removed entries because user was too long afk
}