I am having problems with PHP's documented approach to killing a cookie session.
// If it desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); }
This caused me to see the cookie twice:
Set-Cookie: SESSION_NAME=deleted; expires=Sat, 08-Jan-2011 14:09:10 GMT; path=/; secure Set-Cookie: SESSION_NAME=1_4f09a3871d483; path=/
As stated in the PHP comments, setting a cookie value for something other than empty ('') eliminates the โdeletedโ value, but the second cookie remains.
To get rid of this, I had to add the code suggested above:
ini_set('session.use_cookies', '0');
I did not look at the source of session processing, but I think that setcookie (...) bypasses the session module, so the sessions do not know what I called it. This way it sets the cookie by default after I set up the remote cookie.
I tested mac: PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep 8, 2011 19:34:00)
Michael shebanow
source share