Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini_set('session.cookie_lifetime', 0); #5

Closed
mfurlend opened this issue Dec 3, 2014 · 4 comments
Closed

ini_set('session.cookie_lifetime', 0); #5

mfurlend opened this issue Dec 3, 2014 · 4 comments

Comments

@mfurlend
Copy link

mfurlend commented Dec 3, 2014

On lines 235-237 you have this code:

// make sure session cookies never expire so that session lifetime
// will depend only on the value of $session_lifetime
ini_set('session.cookie_lifetime', 0);

That statement does not make "session cookies never expire." It makes the cookies expire when the browser is closed. In my case this caused authenticated users to be logged off upon termination of the session/browser.

Is this a bug or the intended behavior?

@voku
Copy link

voku commented Dec 5, 2014

"To clear any confusions that may arise: in reality, session.gc_maxlifetime
does not represent a session's lifetime but the number of seconds after
which a session is seen as garbage and is deleted by the garbage
collection routine
. The PHP setting that sets a session's lifetime is
session.cookie_lifetime and is usually set to "0" - indicating that
a session is active until the browser/browser tab is closed. When this class
is used, a session is active until the browser/browser tab is closed and/or
a session has been inactive for more than the number of seconds specified
by session.gc_maxlifetime." - Zebra_Session.php

@mfurlend
Copy link
Author

mfurlend commented Dec 8, 2014

I see that, but if this class is supposed to serve as a drop-in replacement for PHP's built-in session handling shouldn't that line not be there? What is the purpose of ini_set('session.cookie_lifetime', 0)? In my case, I did not want the session to be destroyed when the browser is closed.

@jmathai
Copy link

jmathai commented Jun 14, 2015

Agree with @mfurlend. To use this (wonderful) library we need to fork and change that line of code. Even if we have session.cookie_lifetime set to something longer in php.ini this class will override it.

I don't think it's a valid assumption that site owners typically want sessions to end when a browser is closed.

stefangabos added a commit that referenced this issue Dec 29, 2022
…to the number of seconds specified in the constructor; with this, finally, sessions can be kept alive even if the browser is closed - this fixes #40 and #5
@stefangabos
Copy link
Owner

This is now fixed by a01bdee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants