Skip to content

Conversation

@jefft
Copy link
Contributor

@jefft jefft commented Sep 17, 2025

Jethro has this odd behaviour where it sets the JethroSess cookie, then immediately deletes it and re-issues it in upgrade_session_cookie. The latter appears to be a later addition, to add SameSite=Lax to previously issued cookies.

This PR removes upgrade_session_cookie and sets JethroSess just once. In PHP 7.3+ (ref. #1310) we can set SameSite directly in session_set_cookie_params(), and it's even the default in PHP 8.x.

It is also unnecessary to call session_set_cookie_params() before session_regenerate_id(true), as the new cookie already inherits the set cookie params, including SameSite.

// If max length is set, set the cookie timeout - this will allow sessions to outlast browser invocations
$expiryTime = defined('SESSION_MAXLENGTH_MINS') ? SESSION_MAXLENGTH_MINS * 60 : NULL;
session_set_cookie_params([
'lifetime'=> $expiryTime,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'lifetime'=> $expiryTime,
'lifetime' => $expiryTime,

@jefft jefft force-pushed the push-remove-upgrade_session_cookie branch 2 times, most recently from d007ef2 to 8794a35 Compare September 18, 2025 13:10
@jefft jefft force-pushed the push-remove-upgrade_session_cookie branch from 8794a35 to 51d3dcf Compare September 26, 2025 05:57
@jefft jefft force-pushed the push-remove-upgrade_session_cookie branch 2 times, most recently from 2b71d77 to 78242fe Compare October 14, 2025 06:09
longer supported.  In PHP 7.3+ we can set SameSite directly in
session_set_cookie_params(), and it's even the default in PHP 8.x.

It is also unnecessary to call session_set_cookie_params() before
session_regenerate_id(true), as the new cookie already inherits the set
cookie params, including SameSite.
@jefft jefft force-pushed the push-remove-upgrade_session_cookie branch from 78242fe to d024663 Compare October 17, 2025 02:59
@jefft jefft closed this by deleting the head repository Oct 27, 2025
@jefft
Copy link
Contributor Author

jefft commented Oct 28, 2025

Replaced by #1342

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

Successfully merging this pull request may close these issues.

2 participants