From 447d143b9d525d0cd4a7759af2357c7aec76a8d9 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Fri, 21 Mar 2025 11:47:47 +0100 Subject: [PATCH] Fixed bug GH-13193 again Closes GH-13193. --- NEWS | 2 ++ Zend/zend_gc.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0dce55195c1..02365adeb64 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ PHP NEWS (Arnaud) . Fixed bug GH-15367 (dl() of module with aliased class crashes in shutdown). (Arnaud) + . Fixed bug GH-13193 again (Significant performance degradation in 'foreach'). + (nielsdos) - DOM: . Fix weird unpack behaviour in DOM. (nielsdos) diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 3016ff8a1af..20a764f9a3a 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -1783,7 +1783,7 @@ ZEND_API int zend_gc_collect_cycles(void) bool did_rerun_gc = 0; zend_hrtime_t start_time = zend_hrtime(); - if (GC_G(num_roots) && GC_G(gc_active)) { + if (GC_G(num_roots) && !GC_G(gc_active)) { zend_gc_remove_root_tmpvars(); }