Uh oh!
There was an error while loading. Please reload this page.
Honor use_strict_mode for SessionHandler without validateId - #23071
Open
iliaal wants to merge 1 commit into
Open
Honor use_strict_mode for SessionHandler without validateId#23071iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
SessionHandler does not expose validateId(), so strict mode fell back to php_session_validate_sid() and accepted unknown IDs. Delegate validation for exact SessionHandler instances to the wrapped module. Keep the historical behavior for subclasses, which may implement custom storage. ClosesphpGH-23071
iliaalforce-pushed
the
fix/session-strict-validate-master
branch
from
August 5, 2026 13:28
eeb4cf1 to
36d134dCompare
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 freeto 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.
SessionHandler implements neither SessionUpdateTimestampHandlerInterface nor a validateId() method, so registering it leaves ps_validate_sid undefined and PS_VALIDATE_SID_FUNC(user) falls through to php_session_validate_sid, which returns SUCCESS for every id. With session.use_strict_mode=1 and
session_set_save_handler(new SessionHandler, true), an attacker-supplied id is adopted instead of regenerated. Exact SessionHandler instances now delegate validation to the module they already wrap for read, write and destroy. The check is deliberately on the exact class. A subclass can override read() and write() with its own storage while inheriting the rest, and validating those against the files module is what regressed in GH-9583.