From f38058d22321cf6c297a2098a890afaa58329354 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 9 Mar 2026 13:29:06 -0400 Subject: [PATCH 1/3] ext/pcntl: Bump num_signals to uint16_t (#21347) On AIX, NSIG is def'd as SIGMAX64+1, and SIGMAX64 itself is def'd as 255: ``` $ grep -Rw SIGMAX64 /QOpenSys/usr/include/ /QOpenSys/usr/include/sys/signal.h:#define SIGMAX64 255 /QOpenSys/usr/include/sys/signal.h:#define SIGMAX SIGMAX64 /QOpenSys/usr/include/sys/signal.h:#define NSIG64 (SIGMAX64+1) ``` ...this causes an overflow when we set num_signals from the value of NSIG, per GCC: ``` /rpmbuild/BUILD/php-8.5.3/ext/pcntl/pcntl.c:216:25: warning: large integer implicitly truncated to unsigned type [-Woverflow] PCNTL_G(num_signals) = NSIG; ^~~~ ``` ...when we try to use pcntl to i.e. install a signal handler, we get an error from pcntl: ``` Fatal error: Uncaught ValueError: pcntl_signal(): Argument #1 ($signal) must be less than 0 in phar:///QOpenSys/pkgs/bin/composer/vendor/seld/signal-handler/src/SignalHandler.php:491 ``` The easiest way to deal with this silly AIX behaviour is to just promote the storage size. --- ext/pcntl/php_pcntl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index f2cc0d59195f4..3757c7d9219e6 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -46,7 +46,8 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl) bool processing_signal_queue; volatile bool pending_signals; bool async_signals; - uint8_t num_signals; + /* some OSes define NSIG to be > UINT8_MAX */ + uint16_t num_signals; int last_error; struct php_pcntl_pending_signal *head, *tail, *spares; ZEND_END_MODULE_GLOBALS(pcntl) From 06f9389d69121e895ce05281c6260fde49a8449f Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 9 Mar 2026 14:31:20 -0300 Subject: [PATCH 2/3] Update NEWS for pcntl fix [skip ci] --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index b7d4c1eee441b..dbdb7c906c76b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS . Fixed bug GH-21052 (Preloaded constant erroneously propagated to file-cached script). (ilutov) +- PCNTL: + . Fixed signal handler installation on AIX by bumping the storage size of the + num_signals global. (Calvin Buckley) + - PCRE: . Fixed re-entrancy issue on php_pcre_match_impl, php_pcre_replace_impl, php_pcre_split_impl, and php_pcre_grep_impl. (David Carlier) From 0155b50984d8f32490718d46b43f145b4a90500d Mon Sep 17 00:00:00 2001 From: ndossche <7771979+ndossche@users.noreply.github.com> Date: Mon, 9 Mar 2026 20:45:07 +0100 Subject: [PATCH 3/3] phar: Fix const-generic compile warnings --- ext/phar/phar_object.c | 8 +++----- ext/phar/tar.c | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 2d8ee9c435ed8..d4b084217b5bb 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -46,9 +46,8 @@ static zend_class_entry *phar_ce_entry; static int phar_file_type(const HashTable *mimes, const char *file, char **mime_type) /* {{{ */ { - char *ext; phar_mime_type *mime; - ext = strrchr(file, '.'); + const char *ext = strrchr(file, '.'); if (!ext) { *mime_type = "text/plain"; /* no file extension = assume text/plain */ @@ -347,10 +346,9 @@ static void phar_do_404(phar_archive_data *phar, char *fname, size_t fname_len, /* post-process REQUEST_URI and retrieve the actual request URI. This is for cases like http://localhost/blah.phar/path/to/file.php/extra/stuff which calls "blah.phar" file "path/to/file.php" with PATH_INFO "/extra/stuff" */ -static void phar_postprocess_ru_web(const char *fname, size_t fname_len, const char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */ +static void phar_postprocess_ru_web(char *fname, size_t fname_len, char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */ { - const char *e = entry + 1; - char *u = NULL, *u1 = NULL, *saveu = NULL; + char *e = entry + 1, *u1 = NULL, *u = NULL, *saveu = NULL; size_t e_len = *entry_len - 1, u_len = 0; phar_archive_data *pphar; diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 6a3840b3671c7..0c93de243adcc 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -105,7 +105,8 @@ bool phar_is_tar(const char *buf, const char *fname) /* {{{ */ tar_header *header = (tar_header *) buf; uint32_t checksum = phar_tar_number(header->checksum, sizeof(header->checksum)); bool is_tar; - char save[sizeof(header->checksum)], *bname; + char save[sizeof(header->checksum)]; + const char *bname; /* assume that the first filename in a tar won't begin with