Skip to content

ext/session: Fix GH-16027 session close() not called when write fails#22622

Draft
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-gh16027-session-close-on-exception-8.4
Draft

ext/session: Fix GH-16027 session close() not called when write fails#22622
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-gh16027-session-close-on-exception-8.4

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #16027

@jorgsowa jorgsowa changed the base branch from master to PHP-8.4 July 6, 2026 21:14
Comment thread ext/session/mod_user.c
}

/* Run close() even with a pending exception, so the handler releases its resources; skip real exit()/die() (bug #60634). */
if (EG(exception) && !zend_is_unwind_exit(EG(exception)) && !zend_is_graceful_exit(EG(exception))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dance is never a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using SessionHandler doesn't always close session file

2 participants