Commit f2a89256996 for php
commit f2a89256996908816955c573968715000c3426af
Merge: 906356642d8 a77b1337b43
Author: Arnaud Le Blanc <arnaud.lb@gmail.com>
Date: Mon Oct 5 18:49:43 2026 +0200
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
[ci skip] NEWS
Rethrow exceptions from destructors called by the GC in a fiber (#24118)
diff --cc NEWS
index 4d949ee7420,6134971c6ba..94cad245e0f
--- a/NEWS
+++ b/NEWS
@@@ -22,15 -30,11 +22,17 @@@ PH
function and a later request calls it. (Ilia Alshanetsky)
. Fixed System V shared memory emulation for Windows attaching segments past
the end of their mapping. (Ilia Alshanetsky)
- . Fixed bug GH-24050 (GC frees an object still held by a resurrected closure
- when (object) and use share an array). (David Carlier)
+ . Fixed exception thrown by destructor during GC in a Fiber not being rethrown
+ into the frame that triggered the GC. (Nicolas Grekas)
+- CLI
+ . Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during
+ request activation). (matyhtf)
+ . Fixed bug GH-23764 (Built-in server leaks a file descriptor on every HEAD
+ request for a static file). (jakubskopal)
+ . Fixed the built-in server truncating an error page and leaking its
+ unsent part after a partial socket write. (Ilia Alshanetsky)
+
- DOM:
. Fixed use-after-free when re-constructing a DOMXPath whose php:function
registrations are freed while still reachable from the cycle collector.
diff --cc Zend/zend_gc.c
index 066453552ba,fbe46a435fd..281994dbfd7
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@@ -1992,9 -1933,14 +1993,15 @@@ static zend_never_inline void gc_call_d
}
EG(exception) = exception;
+
+ /* Destructors ran in another fiber, out of reach of zend_call_function()'s rethrow */
+ if (exception && !old_exception && EG(current_execute_data) && EG(current_execute_data)->func
+ && ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
+ zend_rethrow_exception(EG(current_execute_data));
+ }
}
+/* Perform a garbage collection run. The default implementation of gc_collect_cycles. */
ZEND_API int zend_gc_collect_cycles(void)
{
int total_count = 0;