[session] Clear in_save_handler recursion guard on bailout (GH-15529) - #296
Open
iliaal wants to merge 1 commit into
Open
[session] Clear in_save_handler recursion guard on bailout (GH-15529)#296iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
ps_call_handler() set PS(in_save_handler) around call_user_function() with no protection against zend_bailout() from inside a userland save handler callback; a bailout in open/read/write/close/etc. left the flag sticky so the shutdown flush falsely reported "Cannot call session save handler in a recursive manner" and skipped the pending handler calls. Wrap the invocation in zend_try/zend_catch that clears the flag and falls through to argv cleanup before re-bailing out. Sibling audit: all userland handler entry points funnel through ps_call_handler(), so this single guard covers every path; PS_OPEN_FUNC()/PS_CLOSE_FUNC() already carry outer try/catch for their own retval/status cleanup and remain as is. bug60634_error_3.phpt and bug60634_error_4.phpt expected the old sticky-flag warning at request shutdown and are updated to expect the now-working close handler instead. Fixes phpGH-15529
iliaal
force-pushed
the
fix/pux-sticky-flag-84
branch
from
August 26, 2026 12:56
99fdd5b to
21210c7
Compare
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.
ps_call_handler() set PS(in_save_handler) around call_user_function() without zend_bailout() protection, so a fatal error in a userland save handler left it sticky; shutdown warned falsely of recursion, skipped pending calls, losing session data. The call now runs under zend_try/zend_catch clearing the flag, falling through argv cleanup before re-bailing. All userland entry points go through ps_call_handler(), covering open/read/write/destroy/gc/create_sid/validate_sid/update_timestamp via one guard. The bug60634 tests now expect the working close handler instead of the sticky-flag warning.
Fixes phpGH-15529