From:             ewilde at bsmdevelopment dot com
Operating system: Windoze 2003
PHP version:      5.1.4
PHP Bug Type:     Session related
Bug description:  Session destroy/restart not working

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 bug report at http://bugs.php.net/?id=38042&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38042&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38042&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38042&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38042&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38042&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38042&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38042&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38042&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38042&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38042&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38042&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38042&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38042&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38042&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38042&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38042&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38042&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38042&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38042&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38042&r=mysqlcfg

Reply via email to