Commit 10e02b0a4a3 for php.net
commit 10e02b0a4a3e408501e248cebf3ea4c4147e57bd
Merge: ceae788b788 0acde119451
Author: Gina Peter Banyard <girgias@php.net>
Date: Sat Mar 7 13:29:17 2026 +0000
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/session: Fix memory leak due to multiple exception happening during session abort
diff --cc NEWS
index fca3948024a,abe3cc9efb8..5437086c8e7
--- a/NEWS
+++ b/NEWS
@@@ -13,10 -9,10 +13,14 @@@ PH
. Fixed re-entrancy issue on php_pcre_match_impl, php_pcre_replace_impl,
php_pcre_split_impl, and php_pcre_grep_impl. (David Carlier)
+- Phar:
+ . Fixed bug GH-21333 (use after free when unlinking entries during iteration
+ of a compressed phar). (David Carlier)
+
+ - Session:
+ . Fix memory leak due to multiple exception happening during session abort.
+ (arshidkv12)
+
- SNMP:
. Fixed bug GH-21336 (SNMP::setSecurity() undefined behavior with
NULL arguments). (David Carlier)
diff --cc ext/session/session.c
index 489f82d6f14,f8d963b4894..9d2431a2e33
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@@ -1750,11 -1741,19 +1751,19 @@@ PHPAPI php_session_status php_get_sessi
return PS(session_status);
}
-static zend_result php_session_abort(void) /* {{{ */
+static zend_result php_session_abort(void)
{
if (PS(session_status) == php_session_active) {
- if (PS(mod_data) || PS(mod_user_implemented)) {
+ if ((PS(mod_data) || PS(mod_user_implemented)) && PS(mod)->s_close) {
+ zend_object *old_exception = EG(exception);
+ EG(exception) = NULL;
+
PS(mod)->s_close(&PS(mod_data));
+ if (!EG(exception)) {
+ EG(exception) = old_exception;
+ } else if (old_exception) {
+ zend_exception_set_previous(EG(exception), old_exception);
+ }
}
PS(session_status) = php_session_none;
return SUCCESS;