Skip to content

Commit f5bccc0

Browse files
TysonAndrenikic
authored andcommitted
Fix opcache optimizer info for time_nanosleep
This can also return an array. See https://www.php.net/manual/en/function.time-nanosleep.php#refsect1-function.time-nanosleep-returnvalues > If the delay was interrupted by a signal, an associative array will be returned with the components: > > - seconds - number of seconds remaining in the delay > - nanoseconds - number of nanoseconds remaining in the delay Sending a SIGUSR1 to the below program would trigger this behavior. ``` pcntl_signal(\SIGUSR1, function ($signo, $signinfo) { echo "Handling a signal $signo\n"; }); echo "Sleeping for 100 seconds\n"; var_export(time_nanosleep(100, 0)); ``` The incomplete signature existed since c88ffa9. No phpt tests existed for time_nanosleep returning an array
1 parent 16d35eb commit f5bccc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static const func_info_t func_infos[] = {
277277
F0("sleep", MAY_BE_FALSE | MAY_BE_LONG),
278278
F0("usleep", MAY_BE_NULL | MAY_BE_FALSE),
279279
#if HAVE_NANOSLEEP
280-
F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
280+
F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
281281
F0("time_sleep_until", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
282282
#endif
283283
#if HAVE_STRPTIME

0 commit comments

Comments
 (0)