Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The global user variable in user_logout()
is unset()
, but the global variable isn't actually unset. This causes problems with modules like securesite.module (see http://drupal.org/node/21814).
According to PHP.net, "If you would like to unset() a global variable inside of a function, you can use the $GLOBALS array to do so:
function foo() {
unset($GLOBALS['bar']);
}
$bar = "something";foo();
Thus, I've updated user_logout()
to use the $GLOBALS array. I'll also attach a small PHP script to test unsetting global variables.
Comment | File | Size | Author |
---|---|---|---|
#1 | global.php | 359 bytes | Junyor |
drupal-head.user-logout.junyor.patch | 552 bytes | Junyor | |
Comments
Comment #1
Junyor CreditAttribution: Junyor commentedAnd here's the test case.
Comment #2
Dries CreditAttribution: Dries commentedCommitted to HEAD.
If this needs to be backported to Drupal 4.6, please provide a patch.
Comment #3
Junyor CreditAttribution: Junyor commentedThis has been around since user.module was created. I looked through some of the issues related to not being able to logout and I didn't see anything that looked like it was caused by this. I'd say leave it out of 4.7.
Comment #4
(not verified) CreditAttribution: commented