[php-src] PR #23531: ext/pcntl: fix declared signature of pcntl_signal($restart_syscalls)
| From: | lacatoire | Date: | Tue, 01 Sep 2026 15:32:06 +0000 |
| Subject: | [php-src] PR #23531: ext/pcntl: fix declared signature of pcntl_signal($restart_syscalls) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38247@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23531
Author: lacatoire
pcntl_signal() parses its third argument with Z_PARAM_BOOL_OR_NULL(), so
null is accepted, and null is also what selects the SIGALRM
specific default of false:
```c
if (restart_syscalls_is_null && signo == SIGALRM) {
restart_syscalls = 0;
}
```
The stub, however, declared a non-nullable bool defaulting to true, so
Reflection reported a signature the implementation does not honour:
```php
$p = (new ReflectionFunction('pcntl_signal'))->getParameters()[2];
var_dump($p->allowsNull()); // bool(false)
var_dump($p->getDefaultValue()); // bool(true)
pcntl_signal(SIGALRM, fn() => null, null);
echo "null accepted\n"; // no TypeError, no deprecation
```
Every other Z_PARAM_BOOL_OR_NULL() user declares a nullable parameter defaulting to
null — imageinterlace(), json_decode(),
libxml_use_internal_errors() and sapi_windows_vt100_support(). This aligns
pcntl_signal() with them.
Runtime behaviour is unchanged: null was already accepted, and null and an
omitted argument already took the same path. What changes is the declared signature, so Reflection
now reports ?bool $restart_syscalls = null.
Fixes #23530