Would you consider adding the ability to configure Session API to expire its cookie when the browser closes? I think this is possible by setting the $expire parameter of setcookie() to 0. Session API adds time() to beginning of the configuration variable, so we'd either need another configuration option, or perhaps if if the "cookie expire time" variable was set to -1, we could configure the cookie with an expire value of 0. Thoughts? Are there downsides to this?

Comments

jhedstrom’s picture

I'd certainly consider a patch that provided this option. Aside from storing, and then removing a lot of data (eg, if a user flags a bunch of content, then closes their browser), I don't see a downside to making this configurable.

joelstein’s picture

Status: Active » Needs review
StatusFileSize
new2.51 KB

Okay, here you go. This seems to work great in my testing.

joelstein’s picture

What do you think of the patch?

jhedstrom’s picture

The code itself looks good. I'll try to test this out soon.

joelstein’s picture

StatusFileSize
new2.6 KB

Now that #1058960: Use an expiration logic when clearing sessions on cron is committed, this patch needs an update. Here's the latest version.

jhedstrom’s picture

I haven't forgotten about this, I'd just like some other users to test it out before committing.

Scott Ellis’s picture

This patch was built for MichiganLegalHelp.org and it has worked flawlessly for the last six months. I have applied the patch to the most recent development version of Session API with no problem.

jhedstrom’s picture

Status: Needs review » Fixed

Committed #5 in 6db6bad. Thanks!

Scott Ellis’s picture

Great! Thanks Joel and Jonathon. I have updated to the dev branch and everything works great.

Status: Fixed » Closed (fixed)

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