ID: 15983 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Session related Operating System: Debian/Linux mips platform PHP Version: 4.1.2 New Comment:
what about this workaround: --- page #1 --- session_start(); $_SESSION["test"] = "some value"; --------------- --- page #2 --- session_start(); print $_SESSION["test"]; --------------- this works well for us. /achim Previous Comments: ------------------------------------------------------------------------ [2002-04-05 03:50:23] [EMAIL PROTECTED] Even in PHP 4.2.0RC1 the bug is still there. Nothing is changed. Best regards, Soeren, ------------------------------------------------------------------------ [2002-04-02 09:48:13] [EMAIL PROTECTED] Could you try 4.2.0RC1? Please visit http://qa.php.net/ for it. ------------------------------------------------------------------------ [2002-03-18 11:16:41] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [2002-03-12 20:52:42] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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