From: richkerr at disabilitysoft dot com
Operating system: Win98
PHP version: 4.3.10
PHP Bug Type: Session related
Bug description: Session Variable Disappears
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.
--
Edit bug report at http://bugs.php.net/?id=31654&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31654&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31654&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31654&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31654&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31654&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31654&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31654&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31654&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31654&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31654&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31654&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31654&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31654&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31654&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31654&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31654&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31654&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31654&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31654&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31654&r=mysqlcfg