Skip to content

[session] Clear in_save_handler recursion guard on bailout (GH-15529) - #296

Open
iliaal wants to merge 1 commit into
PHP-8.4from
fix/pux-sticky-flag-84
Open

[session] Clear in_save_handler recursion guard on bailout (GH-15529)#296
iliaal wants to merge 1 commit into
PHP-8.4from
fix/pux-sticky-flag-84

Conversation

@iliaal

@iliaal iliaal commented Aug 24, 2026

Copy link
Copy Markdown
Owner

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

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
iliaal force-pushed the fix/pux-sticky-flag-84 branch from 99fdd5b to 21210c7 Compare August 26, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant