From ed9430a5d1c1023bf25769aa33539fd33c6d3a32 Mon Sep 17 00:00:00 2001 From: Appla Date: Wed, 10 Sep 2025 16:37:55 +0800 Subject: [PATCH] Fix hard_timeout when zend-max-execution-timers is enabled Closes GH-19786 --- NEWS | 1 + Zend/zend_execute_API.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8ed895987f9..1af55dd4c84 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PHP NEWS - Core: . Fixed bug GH-19765 (object_properties_load() bypasses readonly property checks). (timwolla) + . Fixed hard_timeout with --enable-zend-max-execution-timers. (Appla) - Standard: . Fixed bug GH-12265 (Cloning an object breaks serialization recursion). diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index fe37b024934..d4a373616fe 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1531,7 +1531,9 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ return; } #elif defined(ZEND_MAX_EXECUTION_TIMERS) - zend_max_execution_timer_settime(seconds); + if (seconds > 0) { + zend_max_execution_timer_settime(seconds); + } if (reset_signals) { sigset_t sigset; @@ -1618,7 +1620,9 @@ void zend_unset_timeout(void) /* {{{ */ tq_timer = NULL; } #elif ZEND_MAX_EXECUTION_TIMERS - zend_max_execution_timer_settime(0); + if (EG(timeout_seconds)) { + zend_max_execution_timer_settime(0); + } #elif defined(HAVE_SETITIMER) if (EG(timeout_seconds)) { struct itimerval no_timeout;