Skip to content

Commit 5af5c17

Browse files
committed
skip delete when needed
1 parent 2c49277 commit 5af5c17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zend/zend_timer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ ZEND_API void zend_timer_settime(zend_long seconds) /* {{{ }*/
8282
ZEND_API void zend_timer_delete(void) /* {{{ */
8383
{
8484
timer_t timer = EG(timer);
85+
if (timer == (timer_t){0}) {
86+
/* Don't trigger an error here because the timer may not be initialized when PHP fail early, and on threads created by PHP but not managed by it. */
87+
# ifdef TIMER_DEBUG
88+
fprintf(stderr, "Could not delete timer that has not been created on thread %d\n", (uintmax_t) timer, (pid_t) syscall(SYS_gettid));
89+
# endif
90+
91+
return;
92+
}
8593

8694
# ifdef TIMER_DEBUG
8795
fprintf(stderr, "Deleting timer %#jx on thread %d...\n", (uintmax_t) timer, (pid_t) syscall(SYS_gettid));

0 commit comments

Comments
 (0)