Conversation
iliaal
requested review from
Girgias,
SakiTakamachi and
jorgsowa
as code owners
September 22, 2026 14:24
ndossche
reviewed
Sep 22, 2026
| bailout = true; | ||
| } zend_end_try(); | ||
| if (!bailout) { | ||
| PS(in_save_handler) = 0; |
Member
There was a problem hiding this comment.
Reading the code, it seems you can just set PS(in_save_handler) unconditionally to 0. Removing the assignment in the zend_catch block and removing the !bailout if-check.
Member
Author
There was a problem hiding this comment.
Moved the reset out of the catch, it runs unconditionally now.
ps_call_handler() set PS(in_save_handler) around call_user_function() with no protection against a zend_bailout() from inside a userland save handler, so a fatal error in open/read/write/close left the flag sticky: the shutdown flush then reported "Cannot call session save handler in a recursive manner" and skipped the pending handler calls. Wrap the invocation in zend_try/zend_catch, clear the flag unconditionally once the block has run, and defer the re-bail until after the argument cleanup. bug60634_error_3.phpt and bug60634_error_4.phpt expected the sticky-flag warning and now expect the close handler to run. Fixes phpGH-15529
iliaal
force-pushed
the
promote/session-bailout-guard
branch
from
September 22, 2026 15:56
c651024 to
2b96d11
Compare
ndossche
approved these changes
Sep 22, 2026
ndossche
left a comment
Member
There was a problem hiding this comment.
Okay but this is a behaviour change though, so deferring the final approval to an ext/session codeowner
Member
Author
|
Agreed, may even need to rebase to just 8.6+, but it is a bug so I'll let the code owner make the final call here. |
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.
A zend_bailout() out of a userland save handler, a fatal error inside write() for instance, skipped the PS(in_save_handler) = 0 store in ps_call_handler(), so the flag stayed set for the rest of the request and the shutdown flush refused to call the handler, reporting "Cannot call session save handler in a recursive manner". The new test forces a real out-of-memory bailout inside write() and checks that the following write() and close() still run. bug60634_error_3.phpt and bug60634_error_4.phpt asserted the old warning and now assert the close handler running.
Fixes #15529