RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Black
I just read further on the manual page for session_register. It also contains the following: Caution This registers a global variable. If you want to register a session variable inside a function, you need to make sure to make it global using global() or use the session arrays as noted below. R

RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Black
Message- From: Richard Fox [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 16:03 To: PHP Subject: RE: [PHP] Session variable scope - surprise! Then, when session_register(""); is called (even on a variable which is going out of scope) what actually happens? Where is the dat

RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Fox
Then, when session_register(""); is called (even on a variable which is going out of scope) what actually happens? Where is the data actually stored? I know it isn't in the file yet (I have session.save_handler = files) because nothing is written to the file until the script exits. So the me

RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Black
DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: [EMAIL PROTECTED] -Original Message- From: Richard Fox [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 15:26 To: [EMAIL PROTECTED] Subject: RE: [PHP] Session variable scope - surprise! OK, but then how do you expla

RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Fox
OK, but then how do you explain: "; } global $HTTP_SESSION_VARS; session_start(); reg(); if (session_is_registered("test")) { $tt = $HTTP_SESSION_VARS["test"]; echo "session variable test=<$tt>"; } else echo "You really don't know what you're doing, do you?"; ?> This still gives me

RE: [PHP] Session variable scope - surprise!

2002-03-04 Thread Richard Black
I think session_register registers the variable and its value as a global. In this case, $test's global value is nothing. nada. Because it doesn't exist globally. In the reg() function, what is being output is a LOCAL variable called $test. Not a global value. If you put the line global