Conversation
When a save handler rejects the session ID under session.use_strict_mode, php_session_initialize() papered over a failing s_create_sid() by generating an internal ID and carrying on, so reset_id()'s Set-Cookie and SID side effects ran for a session that never started, and a second failure left PS(id) NULL. Mirror the primary no-ID branch: abort the session, throw when no exception is pending, and return FAILURE. Sibling sites audited, session_regenerate_id() and session_create_id() already NULL-check with their own error paths.
jorgsowa
approved these changes
Sep 22, 2026
jorgsowa
left a comment
Contributor
There was a problem hiding this comment.
The fix looks sensible but the exception message is invalid. Would be nice to improve it.
|
|
||
| ?> | ||
| --EXPECT-- | ||
| Error: Session id must be a string |
Contributor
There was a problem hiding this comment.
This is not very intuitive error message. Would be worth to investigate why proper exception Failed to create session ID is not propagated.
Edit: fixed negation mistake.
Member
Author
There was a problem hiding this comment.
The handler’s RuntimeException is retained as the previous exception by ps_create_sid_user(). “Failed to create session ID” only runs without a pending exception. I’d fix the misleading wrapper separately.
This was referenced Sep 22, 2026
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.
Under session.use_strict_mode, when a save handler rejects the supplied ID, php_session_initialize() called s_create_sid() and quietly generated an internal ID when that failed. reset_id() then emitted Set-Cookie and defined SID for a session that goes on to fail, and when the internal generation failed too, PS(id) stayed NULL. This mirrors the abort the primary no-ID branch already performs. Same failure class as #23800, which covers session_regenerate_id().