Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.78
diff -u -p -r1.78 user.pages.inc
--- modules/user/user.pages.inc	1 Dec 2010 00:29:41 -0000	1.78
+++ modules/user/user.pages.inc	17 Jan 2011 18:27:54 -0000
@@ -170,9 +170,22 @@ function user_logout() {
 
   module_invoke_all('user_logout', $user);
 
-  // Destroy the current session, and reset $user to the anonymous user.
+  // Obtain the current session's attributes.
+  $params = session_get_cookie_params();
+
+  // Destroy the current session.
   session_destroy();
 
+  // Re-create the current session cookie.
+  session_set_cookie_params($params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']);
+
+  // Start a new session.
+  session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc');
+  session_start();
+
+  // Load the anonymous user using the new session.
+  $user = drupal_anonymous_user(session_id());
+
   drupal_goto();
 }
 
