I am trying to find a reliable method to clean out all session variables and start clean.
Running PHP 4.3.1 on Win2K developing a web app to run on Linux. Session cookies are enabled, register globals is off. I access all session variables with $_SESSION. What I have found is that if I use unset($_SESSION), set a single variable, and redirect, the OLD session data is passed to the new page. However if I use session_unset() or $_SESSION = array() and set my single variable, the data is passed properly. Shouldn't unset($_SESSION) work? Example: Delete the session file, run something that leaves other session data around (or just leave it empty if you prefer), then try this: test1.php: <?php session_start(); # Can also use session_unset() below $_SESSION = array(); $_SESSION["Test1"] = "test1"; header("Location: http://localhost/test2.php"); exit; ?> test2.php: <?php session_start(); var_dump($_SESSION); ?> This will work, the second script will show only the single element "Test1" in $_SESSION. However if you replace: $_SESSION = array(); in test1.php with: unset($_SESSION); then test2.php will show whatever session data was present prior to invoking test1, and will not show the "Test1" array element in $_SESSION. In other words it not only retains the old values, but fails to save the new ones. ---------- Tom Rawson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php