#47800 [NEW]: Sessions won't be loaded when Cookies are disabled

From: Date: Fri, 27 Mar 2009 02:36:36 +0000
Subject: #47800 [NEW]: Sessions won't be loaded when Cookies are disabled
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-135197@lists.php.net to get a copy of this message
From: whistl0r+phpbug at googlemail dot com Operating system: Windows PHP version: 5.3.0RC1 PHP Bug Type: Session related Bug description: Sessions won't be loaded when Cookies are disabled Description: ------------ When forcing PHP to not use cookies for sessions, PHP isn't able to load an existing session. Instead it will create a new one. Tested with the default php.ini (php.ini-production) coming with the php-5.3.0RC1-nts-Win32-VC6-x86.zip package. I just fixed line 428 and set the session.save_path value. Session files will be created as expected. With PHP <5.3, the script is working as expected. I can confirm, that this problem is still present in the latest snapshot (VC6 x86 Thread Safe (2009-Mar-26 19:00:00)). Reproduce code: --------------- <?php // Disable Cookie-Usage ini_set('session.use_cookies', 0); // Start the session session_start(); if (!isset($_SESSION['counter'])) { // Initialize SESSION $_SESSION['counter'] = 1; } else { // Existing SESSION - Update value $_SESSION['counter'] = $_SESSION['counter'] + 1; } // Print SESSION value printf('Counter value #%u<br />' . PHP_EOL, $_SESSION['counter']); // Print Next link printf('<a href="%s?%s">Next</a>', $_SERVER['PHP_SELF'], SID ); Expected result: ---------------- When you first run this code, a session with a variable "counter" with the value "1" (int) should be created and a link pointing to the same script with this SESSION-ID should be displayed. When you click this link, you run this code again and the previous created session should be loaded and the "counter" variable should be incremented by 1. Actual result: -------------- On every run, PHP creates a new session. -- Edit bug report at http://bugs.php.net/?id=47800&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47800&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47800&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47800&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47800&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47800&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47800&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47800&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47800&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47800&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47800&r=support Expected behavior: http://bugs.php.net/fix.php?id=47800&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47800&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47800&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47800&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47800&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47800&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47800&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47800&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47800&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47800&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47800&r=mysqlcfg

« previous php.bugs (#135197) next »