$HTTP_SESSION_VARS invisible in a function with register_globals=Off

From: Date: Sat, 06 Oct 2001 15:05:48 +0000
Subject: $HTTP_SESSION_VARS invisible in a function with register_globals=Off
Groups: php.general 
Request: Send a blank email to php-general+get-70221@lists.php.net to get a copy of this message
I am using PHP 4.0.5 on Debian GNU/Linux with register_globals=Off. I cannot gain access to $HTTP_SESSION_VARS from a function, no matter what I try. This is not the case for other global associative arrays. For example, this page: <? function setup () { global $HTTP_SESSION_VARS, $X; session_start(); ++$HTTP_SESSION_VARS['a']; ++$X['a']; } setup(); ?><html><body>$HTTP_SESSION_VARS['a']=<?=$HTTP_SESSION_VARS['a']?> <br>$X['a']=<?=$X['a']?> </body></html> gives this output every time: $HTTP_SESSION_VARS['a']= $X['a']=1 If I move the ++$HTTP_SESSION_VARS['a']; line to just below the call of setup(), it works as expected, incrementing that value each reload. Why is the real $HTTP_SESSION_VARS invisible from inside a function?!?

« previous php.general (#70221) next »