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
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
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
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
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
ECTED]]
Sent: 04 March 2002 14:57
To: [EMAIL PROTECTED]
Subject: [PHP] Session variable scope - surprise!
This is a behavior I have not found documented, in fact the books I have
read indicated that this would not be the case...
given the script (with session.save_handler = files):
";
}
This is a behavior I have not found documented, in fact the books I have
read indicated that this would not be the case...
given the script (with session.save_handler = files):
";
}
session_start();
reg();
echo "test=<$test>";
?>
The output is:
in reg(), test=<13>
test=<>
I was quite sur
7 matches
Mail list logo