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

SessionHandler - setEX error on session.cookie_lifetime = 0 #50

Closed
forrest79 opened this issue Jun 30, 2015 · 9 comments
Closed

SessionHandler - setEX error on session.cookie_lifetime = 0 #50

forrest79 opened this issue Jun 30, 2015 · 9 comments

Comments

@forrest79
Copy link
Contributor

If you have set configuration session.cookie_lifetime = 0, getTtl() return 0 and setEX try to write 0 for expiration, but redis can't handle this.

@forrest79
Copy link
Contributor Author

Maybe use gc_maxlifetime if cookie_lifetime is 0?

@fprochazka
Copy link
Member

I'm open to suggestions! Would be happy to accept a pullrq also :)

@forrest79
Copy link
Contributor Author

I will definitely make a pullrq after we decide, how we handle this :-) For example Predis SessionHandler check only gc_maxlifetime or user defined value. For me this make sence. If cookie_lifetime is smaller than gc_maxlifetime, then use cookie_lifetime, if gc_maxlifetime is smaller than cookie_lifetime, then use cookie_lifetime and if cookie_lifetime is 0, then use gc_maxlifetime too. We can have session in redis longer than is neccesary, when user close browser before gc_maxlifetime, but I think, that we could life with it :-)

@fprochazka
Copy link
Member

I finally understood what is this issue about :) I should get more sleep more often.
The min() behaviour is implemented here, so I guess we just have to make it smarter to choose the min, but not if one of them is zero?

@forrest79
Copy link
Contributor Author

Yes, that is what I am talking about :-) Maybe I am not so good to describe it in english :-) I don't know if gc_maxlifetime can be zero. Because if it can, I don't know what time return for setEx. If it can't I agreed with you to choose the min but not zero.

@forrest79
Copy link
Contributor Author

Ok, I have tested it and gc_maxlifetime can be set to 0. I can't image what PHP do when gc_maxlifetime is 0, but we need to deside what to do, if gc_maxlifetime = 0 and also cookie_lifetime = 0. Return Nette deafult gc_maxlifetime (3 hours) or PHP default gc_maxlifetime (1440s)?

@fprochazka
Copy link
Member

I would throw an exception if all the resulting time is 0, because that would be just stupid.

@fprochazka
Copy link
Member

You can always change that for session in config and the sessionhandler in kdyby/redis should pick that up.

@fprochazka
Copy link
Member

Fixed by #52

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

2 participants