1) Install remember_me.module on Drupal 4.7.6
2) Log in but do NOT check the "Remember me" box
3) Go to administer/logs
4) Change Filter by message type: and hit the Filter button.
5) Change is lost and reverts to "all messages"

Another bug: Similarly, if I attach a file to a page and hit Submit, nothing happens and the filename field is cleared.

Both problems go away if the "Remember me" box is checked when I log in.

I think somehow the $_SESSION variables are getting reset. I'll bet a bunch of other things are broken too.

(It looks like remember_me_init() repeatedly calls _remember_me_set_lifetime(0); but the value keeps reverting to 2000000.)

Comments

scott.mclewin’s picture

I've just found a variation on what I believe is the same root cause as this issue. My site, www.folkjam.org, maintains $_SESSION variables that keep track of where the user is currently looking for content (we use that to only display content within a radius around the user's location).

When a user logs into the site without the 'remember me' checkbox set, none of the session variables we set survive across page loads - they all get set to their default values.

I think the culprit is in remember_me_init(), where the logic flow causing this particular scenario is:

  // If we have user logged in, then we have session started.
  if ($user->uid) {
    // Get the cookie life time.
    $cookie_lifetime = ini_get('session.cookie_lifetime');
    if ($user->remember_me) {
      // If we have no cookie life time set already then set it.
      if (0 == $cookie_lifetime) {
        _remember_me_set_lifetime(2000000);
      }
    }
    else {
      // If we have cookie life time set already then unset it.
      if (0 != $cookie_lifetime) {
        _remember_me_set_lifetime(0);
      }
    }
  }

That call to _remember_me_set_lifetime(0) clears out anything set in $_SESSION by any other module. I'd be interested in understanding the intended logic flow from this as I'm certain it was done because of a specific case (or cases) that needed to be covered. Making my site work again was as easy as removing the _remember_me_set_lifetime(0) call and the if statement around it - but I want to know what else this might break and whether this is a complete solution before rolling you a patch.

scott.mclewin’s picture

Title: Remember Me module breaks Log filtering and file uploading » Remember Me module resets $_SESSION on every page load, breaking other modules

Changing the title to reflect the broader issue - hope that's ok markdionne

doq’s picture

Assigned: Unassigned » doq
doq’s picture

Can you send me some of your modules that refuse to work with remember_me module?

doq’s picture

2 markdionne:
Works for me in IE and Firefox on Drupal 5.1. Change gets lost only if I close and reopen browser.

doq’s picture

What browsers you use?

Give me your phpinfo please.

markdionne’s picture

Version: 5.x-1.x-dev » 4.7.x-1.x-dev

I see the problem on both IE6.0.2900.2180 and Firefox 2.0.0.4.

The problem is happening with the standard watchdog module, so there is no need to send you "a module that refuses to work".

With Drupal 4, the problem has been happening 100% of the time.

Now that I have switched to Drupal 5, the problem seems intermittent.

The entire phpinfo output is a bit long to post here. Here's an excerpt.

I'm using PHP 4.3.9 Apache/2.0.52 (Red Hat)

session
Session Support enabled
Registered save handlers files user

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/lib/php/session /var/lib/php/session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

markdionne’s picture

Title: Remember Me module resets $_SESSION on every page load, breaking other modules » Yet another case: remember_me breaks the Content Filter page

1) Install remember_me.module on Drupal 5.1
2) Log in but do NOT check the "Remember me" box
3) Go to administer/Content Management/Content (/admin/content/node)
4) Change the "status" dropdown menu and click "Filter".
5) Change of "status" reverts to previous setting an no filtering happens

markdionne’s picture

Title: Yet another case: remember_me breaks the Content Filter page » Remember Me module resets $_SESSION on every page load, breaking other modules

Oops, I changed the title globally by mistake. Changing it back.

scott.mclewin’s picture

@doq - My experiences are right in line with Mark's as far as 4.7 goes, where the problem happens all of the time. We are busy moving folkjam to D5 now and I don't have experience with remember_me for D5 yet.

You can get the behavior with any standard module that uses $_SESSION, such as enabling file uploads on a node type. As a test, modify your local copy of the remember_me module to stash a test value in $_SESSION, such as

$_SESSION['my_test_value'] = time();

and print it out as part of your page.tpl.php somewhere in the header so it is visible on each page. I've not done this particular test, but given the behavior that Mark and I have both seen, I suspect that this will reproduce the problem on Drupal 4.7.

Scott

markdionne’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

Consider switching to persistent_login module. I am told that Persistent Login does not have this problem.

scott.mclewin’s picture

Thanks Mark - the switch is under way now. I like that module's solution better than jacking with session lifetimes too.

As a module maintainer myself I know that at times life gets in the way of handling the issue queue - hopefully doq's schedule allows him/her to give remember me a little attention soon, or formally shut it down in favor of other modules.

Scott

ms2011’s picture

Experiencing the same problem.
For me, it was causing this issue: http://drupal.org/node/155726

Agreed that the logic in this module could be better commented. No way to fix without understanding the reasoning behind it. Switching to persistent login module...

markdionne’s picture

As of Drupal 5.5, this issue is only partly fixed. For example, filtering of users at /admin/user/user is still broken when remember_me is active, while filtering on the logs page seems to be fixed. (The version of remember_me is 1.8.4.1).

nickl’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Active » Needs review

Kindly review and test this patch as a solution to this problem.

nickl’s picture

Status: Needs review » Closed (duplicate)
nickl’s picture

Status: Closed (duplicate) » Closed (fixed)

Closing duplicate issue