|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-22 14:16 UTC] sniper@php.net
[2005-02-10 23:24 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
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.