Bug #15983 Updated: session variables lost between pages
From: phpbug at ehrlichorg dot com Date: Mon, 18 Mar 2002 16:16:42 +0000 Subject: Bug #15983 Updated: session variables lost between pages References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-2774@lists.php.net to get a copy of this message
ID: 15983 Updated by: phpbug@ehrlichorg.com Reported By: sl@scrooge.dk Status: Open Bug Type: Session related Operating System: Debian/Linux mips platform PHP Version: 4.1.2 New Comment: Here is part of what is going wrong. PHP starts out with each session variable appearing as a global and also in $_SESSION. Initially these are linked by reference (not clear how) and contain the same data. On my pages this linkage appears to get broken so the contents $GLOBALS['S'] and $_SESSION['S'] are not the same. $GLOBALS contains the latest data, $_SESSION contains the data as of the start of the page. Consequently changes to the $_SESSION variable are not being saved between pages. My work around is to use the following at the end of each page for $S: if ( !($_SESSION['S'] === $S) ) $_SESSION['S'] = $S; This updates the contents of the $_SESSION variable if it is not longer the same as the global. Based on a comment from one of the developers, the problem may relate to having a global declaration for a session variable that appears outside a function scope. I have these declarations on each of my pages because PHP used to require them. Previous Comments: ------------------------------------------------------------------------ [2002-03-12 20:52:42] php@bradandkristin.com I've had the same issue (see bug 15822, which was marked as a duplicate, though nobody saw fit to tell me what it was a duplicate of). Anyone have a work-around? ------------------------------------------------------------------------ [2002-03-10 09:14:31] sl@scrooge.dk The session variables are lost between pages. For example: session1.php: <? session_start(); $test = "Hello world"; session_register(test); ?> session2.php: <? session_start(); echo $test; ?> The output on page two is the empty string. A look at the sess_* in /tmp show that it contain the variable and the value after a request on session1.php. After a request on session2.php the file is empty. This error shows up in php 4.1.1 and 4.1.2. In version 4.0.6 everything works as it is suppose to. uname --all: Linux indy01 2.4.16 #1 Sun Dec 16 16:38:44 CET 2001 mips unknown gcc --version: 2.95.4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15983&edit=1
Thread (46 messages)
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- Bug #15983 Updated: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Opn->Fbk]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Fbk->Opn]: session variables lost between pages
- #15983 [Opn->Fbk]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Fbk]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Fbk->Opn]: session variables lost between pages
- #15983 [Opn->Fbk]: session variables lost between pages
- #15983 [Fbk->Opn]: session variables lost between pages
- #15983 [Opn->Fbk]: session variables lost between pages
- #15983 [Fbk->Opn]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Opn->Csd]: session variables lost between pages
- #15983 [Csd]: session variables lost between pages
- #15983 [Csd->Asn]: session variables lost between pages
- #15983 [Asn]: session variables lost between pages
- #15983 [Asn->Fbk]: session variables lost between pages
- #15983 [Fbk->Opn]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Opn->Csd]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- #15983 [Csd]: session variables lost between pages
- #15983 [Com]: session variables lost between pages
- Bug #15983 [Com]: session variables lost between pages
| « previous | php.bugs (#2774) | next » |
|---|