Bug #15909 Updated: Session data not updated on page jump
| From: | yohgaki@php.net | Date: | Tue, 26 Mar 2002 05:40:21 +0000 |
| Subject: | Bug #15909 Updated: Session data not updated on page jump | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-3347@lists.php.net to get a copy of this message | ||
ID: 15909
Updated by: yohgaki@php.net
Reported By: phpbug@ehrlichorg.com
Status: Open
Bug Type: Session related
Operating System: Linux Gnu 2.2.12
PHP Version: 4.1.2
New Comment:
Do you use MySQL?
Previous Comments:
------------------------------------------------------------------------
[2002-03-25 21:15:04] phpbug@ehrlichorg.com
PHP Does not appear to be seg faulting; nothing in the logs indicates
that type of error.
------------------------------------------------------------------------
[2002-03-25 05:09:49] yohgaki@php.net
Hmm. It sounds like PHP is segfaulting. (Or bailing out without proper
shutdown)
If you are having segfualts, could you build PHP with --enable-debug
and send the backtrace?
------------------------------------------------------------------------
[2002-03-25 03:18:27] irenem@ms2.hinet.net
It looks like the PHP 4.1.2 forgot to call session_write_close() by
default. I added this call at the end of my program, and solved this
session problem.
------------------------------------------------------------------------
[2002-03-20 06:07:11] johnsparrowuk@yahoo.com
Interesting workaround:
session_register("lastaction");
session_register("userip");
session_register("lines"); // etc etc
$HTTP_SESSION_VARS["xx"] = "Anything"; // this is the magic bit
Although xx isn't a registered session var, and doesn't get stored in
the session, it seems to stimulate PHP to update the session vars in
the file!
With that addition, my apps now work fine under 4.1.2.. (Win 2k, Apache
1.3.23)
John
------------------------------------------------------------------------
[2002-03-18 11:19:08] phpbug@ehrlichorg.com
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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15909
--
Edit this bug report at http://bugs.php.net/?id=15909&edit=1