Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/pcntl/pcntl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ function pcntl_waitid(int $idtype = P_ALL, ?int $id = null, &$info = [], int $fl
function pcntl_wait(&$status, int $flags = 0, &$resource_usage = []): int {}

/** @param callable|int $handler */
function pcntl_signal(int $signal, $handler, bool $restart_syscalls = true): bool {}
function pcntl_signal(int $signal, $handler, ?bool $restart_syscalls = null): bool {}

/** @return callable|int */
function pcntl_signal_get_handler(int $signal) {}
Expand Down
4 changes: 2 additions & 2 deletions ext/pcntl/pcntl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/pcntl/pcntl_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions ext/pcntl/tests/pcntl_signal_restart_syscalls.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
pcntl_signal(): $restart_syscalls is nullable
--EXTENSIONS--
pcntl
--FILE--
<?php
declare(strict_types=1);

$parameter = (new ReflectionFunction('pcntl_signal'))->getParameters()[2];
var_dump((string) $parameter->getType());
var_dump($parameter->allowsNull());
var_dump($parameter->getDefaultValue());

var_dump(pcntl_signal(SIGALRM, SIG_IGN));
var_dump(pcntl_signal(SIGALRM, SIG_IGN, null));
var_dump(pcntl_signal(SIGALRM, SIG_IGN, true));
var_dump(pcntl_signal(SIGALRM, SIG_IGN, false));

try {
pcntl_signal(SIGALRM, SIG_IGN, 1);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

var_dump(pcntl_signal(SIGALRM, SIG_DFL));
?>
--EXPECT--
string(5) "?bool"
bool(true)
NULL
bool(true)
bool(true)
bool(true)
bool(true)
TypeError: pcntl_signal(): Argument #3 ($restart_syscalls) must be of type ?bool, int given
bool(true)
Loading