#38042 [Opn->Bgs]: Session destroy/restart not working
| From: | tony2001@php.net | Date: | Sun, 09 Jul 2006 07:38:01 +0000 |
| Subject: | #38042 [Opn->Bgs]: Session destroy/restart not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99243@lists.php.net to get a copy of this message | ||
ID: 38042
Updated by: tony2001@php.net
Reported By: ewilde at bsmdevelopment dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Windoze 2003
PHP Version: 5.1.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2006-07-09 00:35:02] ewilde at bsmdevelopment dot com
Description:
------------
Session destroy followed by session start appears to no longer start a
new session. The attached code works on 5.1.2 but fails on 5.1.4.
Reproduce code:
---------------
<script language="php">
// Start a new session. This sends a session cookie.
session_start();
if (strlen(session_id()) > 0)
{
// Unset all of the session variables.
$_SESSION = array();
// Delete the session cookie.
if (isset($_COOKIE[session_name()]))
setcookie(session_name(), '', time()-42000, '/');
// Finally, destroy the session itself.
session_destroy();
// Now, fire up a new session. This should send another session
cookie.
session_start();
}
</script>
<html><head>
<title>Session cookie test page</title>
<script type="text/javascript" language="JavaScript1.2">
function SessionCookieCheck()
{
// Look for the start of the session ID cookie in the middle of the
cookies
// string. If we don't find it there, look for it at the very
beginning.
if ((document.cookie.indexOf('<?php echo "; ".session_name()."="
?>')
== -1)
&& (document.cookie.indexOf('<?php echo session_name()."="
?>') !=
0))
window.alert('Cookies must be enabled for this site before you can
continue!');
}
</script>
</head>
<body onLoad="SessionCookieCheck();">
<p>Cookie, cookie, who has the cookie?
</body></html>
Expected result:
----------------
From HTTPLook
Set-Cookie: PHPSESSID=a8285938718a2985abb6aefa834c7a2f; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Set-Cookie: PHPSESSID=deleted; expires=Sat, 09-Jul-2005 00:18:22 GMT;
path=/
Set-Cookie: PHPSESSID=a8285938718a2985abb6aefa834c7a2f; path=/
Actual result:
--------------
From HTTPLook
First, third, etc. time
Set-Cookie: PHPSESSID=3sfu3fa1q2f564dib6dfqtv202; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Set-Cookie: PHPSESSID=ubjl6940iru1vnel68ha0uvj11; path=/
Second, fourth, etc. time
Set-Cookie: PHPSESSID=deleted; expires=Sat, 09-Jul-2005 00:17:46 GMT;
path=/
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38042&edit=1