note 13506 added to ref.session.php
| From: | spam-remove-uksi at uksiland dot com | Date: | Tue, 19 Jun 2001 18:42:38 +0000 |
| Subject: | note 13506 added to ref.session.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14449@lists.php.net to get a copy of this message | ||
I just spent valuable 15 minutes wrestling with this. (PHP 4.0.5 here.)
It seems that if register_globals is on, it does not store the changes that take place in the
$HTTP_SESSION_VARS[] array.
For example, I had this code in one page:
session_register('mp3com');
$HTTP_SESSION_VARS['mp3com'] = 'mp3.com/ilp'; // junk value
Another page asked for the value of 'mp3com' session var, but the value was not provided
with the session data.
As soon as I turned off register_globals in the configuration file, $HTTP_SESSION_VARS began working
as intended.
Apparently what happens is that with register_globals turned on, PHP does mirror the incoming
session variables upon session_start() in the $HTTP_SESSION_VARS array. However, when saving the
state of the session variables, if register_globals are on, it ignores the $HTTP_SESSION_VARS values
for the registered session variables and instead takes them from the global scope. Since I never put
$mp3com into the global scope, PHP probably thought that I "unset" $mp3com and did not
save it.
http://www.php.net/manual/en/ref.session.php