| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2004-06-06 01:15 UTC] bill dot stevens at hotmail dot com
 Description:
------------
using sessions on windows xp/php 4.3.7 and register_globals off does work fine (code below).
same script on debian-woody/php 4.3.1 and register_globals off does not read the session data. only register_globals on solves this (same code).
session-related config on both machines is the same or changes had no effect.
any ideas on config/scripting/stuff welcome :)
Reproduce code:
---------------
if( $this->useSessions )
{
	session_start();
	//	check, whether register globals is enabled
	if( ini_get( "register_globals" ) )
	{
		session_register( $this->sessionVar );
		if( !isset( $GLOBALS[$this->sessionVar] ) )
			$GLOBALS[$this->sessionVar]		=	array();
		$this->sessionData		=	&$GLOBALS[$this->sessionVar];
	}
	//	register globals is off, session_register is useless :-(
	else
	{
		if( isset( $_SESSION ) )
		{
			if( !isset( $_SESSION[$this->sessionVar] ) )
				$_SESSION[$this->sessionVar]	=	array();
			$this->sessionData		=	&$_SESSION[$this->sessionVar];
		}
		else
		{
			if( !isset( $GLOBALS["HTTP_SESSION_VARS"][$this->sessionVar] ) )
				$GLOBALS["HTTP_SESSION_VARS"][$this->sessionVar]	=	array();
			$this->sessionData		=	&$GLOBALS["HTTP_SESSION_VARS"][$this->sessionVar];
		}
	}
}
Expected result:
----------------
register session vars. works on windows, does not on debian.
Actual result:
--------------
no session on debian.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 01:00:02 2025 UTC | 
greetings this must be somehow script related. following code works on both windows/debian: datei1.php: ----------- <?php session_start(); $normal=1; session_register("normal"); $_SESSION['normal'] = 10; header('Location: datei2.php'); ?> datei2.php: ----------- <?php session_start(); session_register("normal"); echo "Normal:". $_SESSION["normal"] ."<br><br>\n"; // prints "Normal:10" ?> a bit weird your script works on win and does not on debian. since all the superglobals where introduced the session-coding changed. the docs include a lot of information (a lot of notice and caution stuff :p) good luck :)from php-doc: > -------- > Caution: > -------- > If you are using $_SESSION (or $HTTP_SESSION_VARS), > do not use session_register(), session_is_registered(), > and session_unregister(). so your files become: <?php session_start(); $normal=12; $_SESSION['normal'] = $normal; header('Location: datei2.php'); ?> <?php session_start(); echo "Normal:". $_SESSION["normal"] ."<br><br>\n"; ?>