Exemple #1
0
 public static function shutdown_handler()
 {
     if (is_array($_SESSION) && count($_SESSION) > 0) {
         if (!self::$sessionStarted) {
             // the _SESSION superglobal gets overwritten by session_start
             // so we save the contents in a temp var
             $tmp = $_SESSION;
             session_start();
             $_SESSION = $tmp;
             self::$sessionStarted = true;
             echo "starting new session ...<br>";
         } else {
             echo "starting existing session ...<br>";
         }
         session_commit();
         echo '$_SESSION not empty, commit session (' . session_id() . ')<br>';
         var_dump($_SESSION);
     } else {
         self::clearSession();
     }
 }