Skip to content

Commit d097f7c

Browse files
committed
* UNIX: fix PHP_FUNCTION(Async_delay) + sleep_async case with zero timeout
1 parent 5c0387a commit d097f7c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,15 @@ static zend_long sleep_async(zend_long ms, zend_long nanoseconds)
11141114
return -1;
11151115
}
11161116

1117+
if (ms == 0 && nanoseconds == 0) {
1118+
ZEND_ASYNC_ENQUEUE_COROUTINE(ZEND_ASYNC_CURRENT_COROUTINE);
1119+
ZEND_ASYNC_SUSPEND();
1120+
if (UNEXPECTED(EG(exception) != NULL)) {
1121+
return -1;
1122+
}
1123+
return 0;
1124+
}
1125+
11171126
if (nanoseconds == 0) {
11181127
zend_async_waker_new_with_timeout(coroutine, ms, NULL);
11191128
} else {

0 commit comments

Comments
 (0)