[session] Close save handler before re-initializing an active session - #261
Open
iliaal wants to merge 1 commit into
Open
[session] Close save handler before re-initializing an active session#261iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
php_session_initialize() now aborts an already-active session (closing the save handler) before reopening it, so session_reset() no longer calls open() twice with no close(). Sibling audit: php_session_start() returns early while a session is active; the strict-mode create_sid fallback leaves the close to the existing php_session_reset_id() failure guard, which already calls php_session_abort(); the rfc1867 update/cleanup callbacks are covered by the same new guard.
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.
php_session_initialize() could be entered while a session was already active, e.g. through session_reset() or the rfc1867 upload-progress callbacks, causing the save handler open() method to be invoked a second time with no intervening close(), which leaks the first handler instance and breaks userland handlers that track state per open/close pair. The initialize path now aborts an already-active session, which closes the handler via php_session_abort(), before reopening it. Sibling audit: php_session_start() already returns early while a session is active; the strict-mode create_sid fallback branch relies on the existing php_session_reset_id() failure guard, which already closes the handler; and a new regression test asserts the expected open/read/close/open/read callback sequence.