#37999 [NEW]: session restarts for no reason when using global var?

From: Date: Mon, 03 Jul 2006 22:01:38 +0000
Subject: #37999 [NEW]: session restarts for no reason when using global var?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99074@lists.php.net to get a copy of this message
From: atwistedmindisagiftforlife at hotmail dot com Operating system: FreeBSD6.0 PHP version: 5.1.4 PHP Bug Type: Session related Bug description: session restarts for no reason when using global var? Description: ------------ Session randomizes, doesnt pickup Session id's from query string or cookie, when using $_SERVER or $_ENV before starting session. Reproduce code: --------------- <?php /* uncomment any line below to reproduce */ //$test = $_SERVER['REQUEST_URI']; //$test = $_SERVER['REMOTE_ADDR']; //$test = $_SERVER['']; session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } echo $_SESSION['count']; echo " <a href=\"test.php\">Refresh</a>"; echo '<pre>'; print_r(apache_response_headers()); ?> Expected result: ---------------- Well as there is no output, I assume it to use the session from the query_string, or cookie on the occasions it actually gets set. Actual result: -------------- When uncommenting any of the 3 commented lines above: - it constantly refreshes the session - 80% of the times applies urlrewrite which indecates cookies not working while it should. It works on $_ENV i believe too and possibly some other (global) arrays. Problem is I included classes before starting the session that are saved within the session. Without uncommenting the code runs perfect. Assigning strings & integers worked fine (havent tested any others), but using such a variable it resets. -- Edit bug report at http://bugs.php.net/?id=37999&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37999&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37999&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37999&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37999&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37999&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37999&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37999&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37999&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37999&r=support Expected behavior: http://bugs.php.net/fix.php?id=37999&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37999&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37999&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37999&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37999&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37999&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37999&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37999&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37999&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37999&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37999&r=mysqlcfg

« previous php.bugs (#99074) next »