Repository navigation
Conversation
…mode With lazy_write, an empty new session triggered updateTimestamp() instead of write(). Handlers whose updateTimestamp() does not create records never stored it, so strict mode rejected the ID and issued a new one on every request.
iliaal
approved these changes
Nov 13, 2026
| session.cache_limiter= | ||
| --FILE-- | ||
| <?php | ||
| class Handler implements SessionHandlerInterface, SessionIdInterface, SessionUpdateTimestampHandlerInterface |
Member
There was a problem hiding this comment.
Nit: this handler is identical to the one in lazy_write_new_session_id_no_id.phpt. Could merge both cases into a single test.
Contributor
Author
There was a problem hiding this comment.
Thanks. I specifically put them into separate files to have simpler to understand different paths.
Contributor
Author
|
@Girgias , do you also think it's sensible to merge? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 86b4921, lazy_write calls updateTimestamp() instead of write() for a session that is read as empty and stays empty. That includes a session whose ID was just created.
Many handlers, such as redis and memcached, only refresh existing records in
updateTimestamp(). With those handlers, a new empty session is never stored. Withsession.use_strict_mode=1, which is now the default, the next request's ID failsvalidateId()and a new ID is issued. The client gets a new session ID on every request until something is written to the session.Steps, with default settings:
updateTimestamp(A)is called and A is never stored.validateId(A)fails, so a new ID B is issued, and step 1 repeats.The fix skips the
lazy_writecomparison when the ID was created in the current request, so a new session is written once, as in 8.5. Existing empty sessions still getupdateTimestamp(), so the fix for bug 71162 is kept.