#37999 [Opn->Fbk]: session restarts for no reason when using global var?
| From: | tony2001@php.net | Date: | Wed, 05 Jul 2006 09:02:46 +0000 |
| Subject: | #37999 [Opn->Fbk]: session restarts for no reason when using global var? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99112@lists.php.net to get a copy of this message | ||
ID: 37999
Updated by: tony2001@php.net
Reported By: atwistedmindisagiftforlife at hotmail dot com
-Status: Open
+Status: Feedback
Bug Type: Session related
Operating System: FreeBSD6.0
PHP Version: 5.1.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-07-03 22:01:37] atwistedmindisagiftforlife at hotmail dot com
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 this bug report at http://bugs.php.net/?id=37999&edit=1