Commit d2467bd8e22 for php
commit d2467bd8e2262503845360a32bf3db2fdb481a5d
Merge: fc76b3aae24 be83d085cbb
Author: David Carlier <devnexen@gmail.com>
Date: Tue Nov 17 21:52:05 2026 +0000
Merge branch 'PHP-8.6'
* PHP-8.6:
ext/pcntl: Fix pcntl_signal() fatal error for SIGKILL and SIGSTOP
# Conflicts:
# ext/pcntl/pcntl.c
diff --cc ext/pcntl/pcntl.c
index 3492444925c,b247e4c6522..7c8f9d5cc43
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@@ -808,6 -808,25 +808,25 @@@ PHP_FUNCTION(pcntl_signal
RETURN_THROWS();
}
+ if (Z_TYPE_P(handle) == IS_LONG) {
+ if (Z_LVAL_P(handle) != (zend_long) SIG_DFL && Z_LVAL_P(handle) != (zend_long) SIG_IGN) {
+ zend_argument_value_error(2, "must be either SIG_DFL or SIG_IGN when an integer value is given");
+ RETURN_THROWS();
+ }
- } else if (!zend_is_callable_ex(handle, NULL, 0, NULL, NULL, NULL)) {
++ } else if (!zend_is_callable(handle, NULL, NULL)) {
+ PCNTL_G(last_error) = EINVAL;
+
+ zend_argument_type_error(2, "must be of type callable|int, %s given", zend_zval_value_name(handle));
+ RETURN_THROWS();
+ }
+
+ /* sigaction() always fails for these, and zend_sigaction() turns that into a fatal error */
+ if (signo == SIGKILL || signo == SIGSTOP) {
+ PCNTL_G(last_error) = EINVAL;
+ php_error_docref(NULL, E_WARNING, "Error assigning signal");
+ RETURN_FALSE;
+ }
+
if (!PCNTL_G(spares)) {
/* since calling malloc() from within a signal handler is not portable,
* pre-allocate a few records for recording signals */