$HTTP_SESSION_VARS + register_globals=on (bug?)

From: Date: Sun, 03 Sep 2000 19:15:24 +0000
Subject: $HTTP_SESSION_VARS + register_globals=on (bug?)
Groups: php.general 
Request: Send a blank email to php-general+get-14989@lists.php.net to get a copy of this message
Is there a way to handle session variables without caring about register_globals setting? Assuming "track_vars = on", the manual shows the following sample usage // when "register_globals = on" $count++; // -> 1, 2, 3, ... // when "register_globals = off" $HTTP_SESSION_VARS["count"]++; // -> 1, 2, 3, ... and then says If both track_vars and register_globals are enabled, then the globals variables and the $HTTP_SESSION_VARS entries will reference the same value. so I thought the latter usage would be safe for "register_globals = on", too, but I got // register_globals = on session_register("count"); $HTTP_SESSION_VARS["count"]++; print($HTTP_SESSION_VARS["count"]); // -> 1, 1, 1, ... the following maybe give a better understanding of what's going on // register_globals = on session_register("count"); $count++; print($count); // -> 1, 2, 3, ... print($HTTP_SESSION_VARS["count"]); // -> NULL, 1, 2, ... $HTTP_SESSION_VARS seems to be filled with (global) session variables only at the end of the script. If this is the case, $HTTP_SESSION_VARS seems to me to be pretty useless when "register_globals = on", and you are forced to use only global variables. Is this a bug or am I missing something? (I am using PHP 4.0.2 on Linux.) TIA. -- Mirko Nasato

« previous php.general (#14989) next »