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.

CommentFileSizeAuthor
#1 global.php359 bytesJunyor
drupal-head.user-logout.junyor.patch552 bytesJunyor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Junyor’s picture

FileSize
359 bytes

And here's the test case.

Dries’s picture

Status: Needs review » Fixed

Committed to HEAD.
If this needs to be backported to Drupal 4.6, please provide a patch.

Junyor’s picture

This 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.

Anonymous’s picture

Status: Fixed » Closed (fixed)