Skip to content

pcntl: fix the reference pages and document the 8.4 failure return - #5767

Open
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:group/pcntl-fixes-and-84
Open

pcntl: fix the reference pages and document the 8.4 failure return#5767
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:group/pcntl-fixes-and-84

Conversation

@lacatoire

@lacatoire lacatoire commented Aug 16, 2026

Copy link
Copy Markdown
Member

Fixes several inaccuracies on the pcntl reference pages and documents the PHP 8.4.0 failure return.

  • pcntl_exec() returns false only on failure; on success the process image is replaced and the function does not return. pcntl_unshare() returns a bool, not 0/-1.
  • pcntl_sigprocmask(), pcntl_sigtimedwait(), pcntl_sigwaitinfo(): the changelog rows named a signal parameter that does not exist (it is signals), and used <classname> for thrown exceptions.
  • Added the 8.4.0 failure-return row to pcntl_sigtimedwait() and pcntl_sigwaitinfo(); an empty signals does not throw when mode is SIG_SETMASK; nanoseconds must be between 0 and 1e9, not merely non-negative.
  • versions.xml: pcntl_forkx (8.2.0), pcntl_getcpu (8.4.0), pcntl_setns (8.4.0) and pcntl_wifcontinued (7.0.0) were missing.
  • constants.xml: SI_MSGGQ does not exist in php-src; the constant is SI_MESGQ, documented just above.
  • The seealso simplelists move out of their <para>.

Sources

  • UPGRADING for PHP 8.4, PCNTL sections: failure return ("now always return false on failure. In some case previously it could return the value -1"), thrown exceptions including the SIG_SETMASK exception, and the new functions.
  • ext/pcntl/pcntl.stub.php for signatures, parameter names and per-tag availability; SI_MESGQ in pcntl_arginfo.h, no SI_MSGGQ anywhere.
  • Behaviour checked on php:8.4-cli with pcntl built in: pcntl_sigprocmask(SIG_SETMASK, []) returns true without throwing, and pcntl_sigtimedwait([SIGTERM], $i, 0, 2e9) throws ValueError: Argument #4 ($nanoseconds) must be between 0 and 1e9.

- pcntl_exec(): it only returns false on failure; on success the process image is replaced and the function does not return.
- pcntl_unshare(): it returns a bool, not 0 or -1.
- pcntl_sigprocmask(), pcntl_sigtimedwait(), pcntl_sigwaitinfo(): the parameter is named signals, and the thrown classes are marked up as exceptionname.
- pcntl_sigtimedwait(), pcntl_sigwaitinfo(): document that failure now returns false, where -1 could be returned before PHP 8.4.0.
- pcntl_sigprocmask(): an empty signals array is accepted when mode is SIG_SETMASK.
- pcntl_sigtimedwait(): nanoseconds must be between 0 and 1e9, not merely non-negative.
- versions.xml: add pcntl_forkx, pcntl_getcpu, pcntl_setns and pcntl_wifcontinued.
- constants.xml: drop SI_MSGGQ, which does not exist; the constant is SI_MESGQ and is already documented.
- move the seealso simplelists out of their para.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant