Repository navigation
Conversation
Since 86b4921, php_session_save_current_state() returns without calling the save handler's close callback when the serializer returns NULL, e.g. for a $_SESSION key containing '|'. session_write_close() still returns true, but the files handler keeps its LOCK_EX on the session file until request shutdown, blocking concurrent requests for the same session, and a user handler extending SessionHandler has its close() run at shutdown after the session is gone. Close the handler on that return as the rest of the function and session_regenerate_id() do; with an exception pending the engine already refuses to call a user close() callback.
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, a session that cannot be encoded (for example a $_SESSION key containing a pipe with the php serializer) makes session_write_close() return early without closing the save handler, so the files handler keeps the session file locked until the end of the request and concurrent requests for that session block on it. This only affects PHP-8.6 and master; 8.5 and earlier always reached the close. The handler is now closed on that return, like the rest of the function and session_regenerate_id() already do, including when an exception is pending, since the engine does not invoke a user close() callback in that state anyway.
/cc @Girgias