[php-src] PR #22440: Fix session memory leak on failed user save handler close
| From: | abolfazl-moeini | Date: | Wed, 24 Jun 2026 16:35:43 +0000 |
| Subject: | [php-src] PR #22440: Fix session memory leak on failed user save handler close | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36615@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22440
Author: abolfazl-moeini
Fixes the memory leak reported in #21200 after #21200 was reverted in 3073948885.
The reverted patch saved/restored
EG(exception) around s_close() in
php_session_abort(). That changed exception behaviour and did not fix
leaks when a SessionHandler subclass close() returned false without
calling parent::close().
Changes:
- php_session_abort() tears down session state like
php_rshutdown_session_globals()
- ps_close_user() closes the default save handler when mod_data is still
set
Tests (debug build leak detection):
- ext/session/tests/session_abort_validateid_leak.phpt
- ext/session/tests/session_close_false_leak.phpt