php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37999 session restarts for no reason when using global var?
Submitted: 2006-07-03 22:01 UTC Modified: 2006-07-13 01:00 UTC
From: atwistedmindisagiftforlife at hotmail dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.1.4 OS: FreeBSD6.0
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-07-03 22:01 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-05 09:02 UTC] tony2001@php.net
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


 [2006-07-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC