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

Fix cookies with session lifetime #18820

Merged
merged 1 commit into from Feb 20, 2022
Merged

Fix cookies with session lifetime #18820

merged 1 commit into from Feb 20, 2022

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Feb 18, 2022

Description:

As a regression from #18179 cookies with session lifetime don't work anymore.

As stated in the Cookie class an expire of 0 should indicate a session cookie:

matomo/core/Cookie.php

Lines 81 to 82 in 9c666ab

* @param int|string $expire The timestamp after which the cookie will expire, eg time() + 86400;
* use 0 (int zero) to expire cookie at end of browser session

But that doesn't work anymore as the lifetime will be always converted to a datetime, resulting in 01-Jan-1970 00:00:00 UTC, causing the cookie to be never set.

fixes #18819

Review

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Feb 18, 2022
@sgiehl sgiehl added this to the 4.8.0 milestone Feb 18, 2022
Copy link
Contributor

@peterhashair peterhashair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@peterhashair peterhashair merged commit 2e1c781 into 4.x-dev Feb 20, 2022
@peterhashair peterhashair deleted the m18819 branch February 20, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix cookies with session lifetime
2 participants