|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-09 07:38 UTC] tony2001@php.net
[2006-10-21 05:33 UTC] ewilde at bsmdevelopment dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 16:00:01 2025 UTC |
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=/