php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: richkerr at disabilitysoft dot com
New email:
PHP Version: OS:

 

 [2005-01-22 10:56 UTC] richkerr at disabilitysoft dot com
Description:
------------
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:
---------------
results.php:

session_start();

/*prepare search vars (most previously set via $_POST - $_SESSION no prob
if(isset($_SESSION['cmd'])){
	$cmd = $_SESSION['cmd'];
	if(substr($cmd, 0, 2) == 'bw')
		$db = 'w';
	else
		$db = 'a';
}else
	$db='a';
if(isset($_GET['page'])){
	if($_GET['page'] != '')
		$page = $_GET['page'];
	else
		$page = 1;
}else
	$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:

session_start();
//check for already logged in
EnsureSessVarSet("usr_login");
$usr_login = $_SESSION["usr_login"];
EnsureSessVarSet("usr_password");
$usr_password = $_SESSION["usr_password"];
EnsureSessVarSet("usr_db");
$usr_db = $_SESSION["usr_db"];
function EnsureSessVarSet($index){
	if(!isset($_SESSION[$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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-22 14:16 UTC] sniper@php.net
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] sniper@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC