Skip to content

Commit 8e4dbf1

Browse files
committed
Fix inconsistent behavior for zend_set_timeout_ex/zend_unset_timeout when zend-max-execution-timers is enabled.
1 parent 96c0bc5 commit 8e4dbf1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Zend/zend_execute_API.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,9 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */
15311531
return;
15321532
}
15331533
#elif defined(ZEND_MAX_EXECUTION_TIMERS)
1534-
zend_max_execution_timer_settime(seconds);
1534+
if (seconds > 0) {
1535+
zend_max_execution_timer_settime(seconds);
1536+
}
15351537

15361538
if (reset_signals) {
15371539
sigset_t sigset;
@@ -1618,7 +1620,9 @@ void zend_unset_timeout(void) /* {{{ */
16181620
tq_timer = NULL;
16191621
}
16201622
#elif ZEND_MAX_EXECUTION_TIMERS
1621-
zend_max_execution_timer_settime(0);
1623+
if (EG(timeout_seconds)) {
1624+
zend_max_execution_timer_settime(0);
1625+
}
16221626
#elif defined(HAVE_SETITIMER)
16231627
if (EG(timeout_seconds)) {
16241628
struct itimerval no_timeout;

0 commit comments

Comments
 (0)