Skip to content

Commit 976ae98

Browse files
committed
* UNIX: fix PHP_FUNCTION(Async_delay) + sleep_async case with zero timeout
1 parent 2ab2e15 commit 976ae98

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

async.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,14 @@ PHP_FUNCTION(Async_delay)
572572
return;
573573
}
574574

575-
zend_async_waker_new_with_timeout(coroutine, ms, NULL);
575+
if (UNEXPECTED(ms == 0)) {
576+
ZEND_ASYNC_ENQUEUE_COROUTINE(ZEND_ASYNC_CURRENT_COROUTINE);
577+
} else {
578+
zend_async_waker_new_with_timeout(coroutine, ms, NULL);
576579

577-
if (UNEXPECTED(EG(exception) != NULL)) {
578-
RETURN_THROWS();
580+
if (UNEXPECTED(EG(exception) != NULL)) {
581+
RETURN_THROWS();
582+
}
579583
}
580584

581585
ZEND_ASYNC_SUSPEND();

0 commit comments

Comments
 (0)