Commit 5faa54d93bd for php.net

commit 5faa54d93bd5b30397352a9534b4df964a1d75e0
Author: David Carlier <devnexen@gmail.com>
Date:   Fri Dec 19 12:49:17 2025 +0000

    ext/pcntl: fix pcntl_getcpuaffinity() for solaris.

    trusting the call to handle invalid process id via errnos.

    see https://github.com/php/php-src/pull/20709#discussion_r2630221301 for
    rationale.

    close GH-20731

diff --git a/NEWS b/NEWS
index 7dca021c376..2fb8cd3620f 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,10 @@ PHP                                                                        NEWS
   . Fixed bug GH-20674 (mb_decode_mimeheader does not handle separator).
     (Yuya Hamada)

+- PCNTL:
+  . Fixed bug with pcntl_getcpuaffinity() on solaris regarding invalid
+    process ids handling. (David Carlier)
+
 - Phar:
   . Fixed bug GH-20732 (Phar::LoadPhar undefined behavior when reading fails).
     (ndossche)
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 27e0c90dc96..2034ca80b05 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -93,7 +93,7 @@ typedef cpuset_t *cpu_set_t;
 #elif defined(HAVE_PSET_BIND)
 #include <sys/pset.h>
 typedef psetid_t cpu_set_t;
- #define sched_getaffinity(p, c, m) pset_bind(PS_QUERY, P_PID, (p <= 0 ? getpid() : p), &m)
+ #define sched_getaffinity(p, c, m) pset_bind(PS_QUERY, P_PID, p, &m)
  #define sched_setaffinity(p, c, m) pset_bind(m, P_PID, (p <= 0 ? getpid() : p), NULL)
  #define PCNTL_CPUSET(mask) mask
  #define PCNTL_CPU_ISSET(i, mask) (pset_assign(PS_QUERY, (processorid_t)i, &query) == 0 && query == mask)