The logout functionality stops working after using services along with bakery module (http://drupal.org/project/bakery) and applying this patch (http://drupal.org/node/1369660#comment-5360870). In my opinion this actually is the way its supposed to work, calling the user_module_invoke('logout') hook before destroying the session, like core does -> http://drupalcode.org/project/drupal.git/blob/7c4e429b7fa771676a18321aac...

@@ -401,10 +401,10 @@ function _user_resource_logout() {
 
   watchdog('user', 'Session closed for %name.', array('%name' => theme('placeholder', $user->name)));
 
-  // Destroy the current session:
-  session_destroy();
   $null = NULL; // Only variables can be passed by reference workaround
   user_module_invoke('logout', $null, $user );
+  // Destroy the current session:
+  session_destroy();
 
   // Load the anonymous user
   $user = drupal_anonymous_user();

Comments

artkon’s picture

cotto’s picture

Status: Active » Reviewed & tested by the community

After looking into this a bit, I agree with the #1 patch. Core Drupal 6.22 from d.o does not do what you said, but Pressflow does and the Pressflow approach makes sense to me after a bit of digging. Without the patch, it isn't possible for a hook_user logout implementation to mess with $SESSION data, which it should be able to do. It's not entirely surprising that this issue wouldn't be common since most modules don't care about implementing hook_user('logout', ...).

The patch makes sense and doesn't cause any new failures, so moving this to rtbc. Thanks for reporting!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, move_logout_hooks_before_sess_destroy-1414344-1.patch, failed testing.

marcingy’s picture

Version: 6.x-3.1 » 7.x-3.x-dev

The issue still exists in 7.x so we need to fix it there first - the logic makes sense though for doing this change and this patch looks good for 6.x

cotto’s picture

StatusFileSize
new844 bytes

Here's a 7.x-3.x version.
edit: ignore this patch. A more correct one is in the next comment.

cotto’s picture

Status: Needs work » Needs review
StatusFileSize
new606 bytes

previous patch was wacky. Here's a better one.

kylebrowning’s picture

Status: Needs review » Reviewed & tested by the community

looks commit, go ahead and commit both!

cotto’s picture

Status: Reviewed & tested by the community » Fixed

fixes for 6.x-3.x and 7.x-3.x committed in 6d1d558 and d2750e6, respectively. Thanks for reporting!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Closed (fixed) » Needs review
marcingy’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

Please do not randomly requeue patches that were merged a long time ago