views:

26

answers:

2

It took me a while to realize that $_SESSION['user'] was changing because I have a variable set: $user = array();

Is this normal? I haven't had this issue until today, not sure if it is a server/php setting

A: 

Depends on how you set $_SESSION['user'].

If you are setting it by reference then it is tied to the variable you used to set it.

ie.

$_SESSION['user'] =& $user;

$user = array();

now $_SESSION['user'] is an empty array

Janek
No I never had that, my login process page set it as:$_SESSION['user'] = $users_array['id'];Although that is nice to know for the future
kilrizzy
+3  A: 

Try turning off register_globals in your php.ini file.

sakabako
+1, this is bound to be the culprit
just somebody
Hmm, I don't know if I can since I am on shared hosting but after reading up on r.g. this is almost positively the answer. Thank you!
kilrizzy