|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31654 Session Variable Disappears
Submitted: 2005-01-22 10:56 UTC Modified: 2005-02-10 23:24 UTC
From: richkerr at disabilitysoft dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.3.10 OS: Win98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: richkerr at disabilitysoft dot com
New email:
PHP Version: OS:


 [2005-01-22 10:56 UTC] richkerr at disabilitysoft dot com
Calling session_start() in separate page causes session variables set elsewhere to disappear despite confirmed identical session name and id and no referencing of disppearing vars.

Server is Apache 1.3.33 (Unix). Local machine Win98, browser IE6.

session_start() is only sess func used. isset, assignment, and reference of $_SESSION array is full extent of sess operations.
Search params are sess vars, so results page can be refreshed and still get the same results. Clicking on a login link that opens a separate window that calls session_start causes search params to disappear.  

Search params never referenced on login page. Login page is just session_start() and check of 'login' and 'password' related vars. Removing any reference to $_SESSION with just a sesssion_start() call doesn't stop prob.  Followup with removing call to session_start() stops prob. session_id() confirms identical session is in use.

Sess vars used extensively in web app with similar archtecture without prob anywhere else. Problem is guaranteed with the call to session_start, identical session confirmed, and removing call to session_start() stops search params from disappearing.

Wonder if you know what the prob could be?

Reproduce code:


/*prepare search vars (most previously set via $_POST - $_SESSION no prob
	$cmd = $_SESSION['cmd'];
	if(substr($cmd, 0, 2) == 'bw')
		$db = 'w';
		$db = 'a';
	if($_GET['page'] != '')
		$page = $_GET['page'];
		$page = 1;
	$page = 1;

//abort search and redirect to index.php if no sess vars
if($_SESSION[$cmd ."City"] == "" and $_SESSION[$cmd ."State"] == "" and $_SESSION[$cmd ."Zip"] == "" ){
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."index.php");	
....goes on to call to OutputSearchResults()...

Login page:

//check for already logged in
$usr_login = $_SESSION["usr_login"];
$usr_password = $_SESSION["usr_password"];
$usr_db = $_SESSION["usr_db"];
function EnsureSessVarSet($index){
		$_SESSION[$index] = "";

//if $usr_login and $usr_password != "" then already logged in

Expected result:
Calling session_start() should not cause other sess vars to disappear when session_name and session_id are identical and those sess vars have not been referenced. 

Actual result:
Calling session_start() in separate window causes non-referenced sess vars to disappear despite identical session_id() and no referencing of the disappeared vars.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-22 14:16 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2005-02-10 23:24 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 05:01:23 2023 UTC