php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76899 pcntl_async_signals not available in phpdbg
Submitted: 2018-09-18 09:04 UTC Modified: 2019-03-27 09:49 UTC
From: kaplun at protonmail dot com Assigned: krakjoe (profile)
Status: Closed Package: phpdbg
PHP Version: 7.2.10 OS: CentOS 7
Private report: No CVE-ID: None
 [2018-09-18 09:04 UTC] kaplun at protonmail dot com
Description:
------------
pcntl_async_signals(), although available in the PHP interpreter is not available under phpdbg.

Test script:
---------------
<?php
echo pcntl_async_signals($on=1);
echo pcntl_async_signals();


Expected result:
----------------
Running: phpdbg -qrr test.php

I expect it to output "1".

Actual result:
--------------
[Uncaught Error in /tmp/test.php on line 2]
Error: Call to undefined function pcntl_async_signals() in /tmp/test.php:2
Stack trace:
#0 {main}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-18 09:11 UTC] kaplun at protonmail dot com
Note that what I reported was found out on webtatic repo.

On Ubuntu 18.04, the functions are explicitly disabled for phpdbg in /etc/php/7.2/phpdbg/php.ini

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,

However nowhere it is explained why these are disabled.
 [2018-09-18 11:52 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-09-18 11:52 UTC] requinix@php.net
The php.ini you see is actually provided by way of php7.2-common's php.ini-production. We can't do anything for it.

https://packages.ubuntu.com/bionic/php7.2-phpdbg
https://packages.ubuntu.com/bionic/php7.2-common
You could make a bug report for -phpdbg to do something else. Or for -common to document why those functions are disabled, which is almost definitely for security and/or technical reasons.
 [2018-09-18 12:01 UTC] cmb@php.net
ext/pcntl declares itself to be a cli only extension[1].  cli only
extensions can presently only be enabled for cli, cgi and
embed[2], which might have been an oversight.

[1] <https://github.com/php/php-src/blob/php-7.3.0RC1/ext/pcntl/config.m4#L27>
[2] <https://github.com/php/php-src/blob/php-7.3.0RC1/acinclude.m4#L974-L982>
 [2018-09-18 12:04 UTC] kaplun at protonmail dot com
> The php.ini you see is actually provided by way of php7.2-common's php.ini-production. We can't do anything for it.

This is true for Ubuntu.

On CentOS7/Webtatic instead they are not explicitly disabled, and that what leads to:

[Uncaught Error in /tmp/test.php on line 2]
Error: Call to undefined function pcntl_async_signals() in /tmp/test.php:2
Stack trace:
#0 {main}

So either webtatic "forgot" to enable pcntl_async_signals during phpdbg compilation, or there's a general reason why this can not be available in phpdbg at all, which bring me to the reason why opened the bug report in the first place: there's no documentation around stating that phpdbg does not support pcntl_async_signals (at least I wasn't able to find it), however both on CentOS and Ubuntu this is not an available feature (either not compiled in, or explicitly disabled). Is this:
* a bug (for CentOS/Ubuntu)
* a missed documentation (for PHP.net as a whole and/or phpdbg)
* a missing feature (for PHP.net as whole and/or phpdbg)
 [2018-09-18 12:54 UTC] kaplun at protonmail dot com
I am trying to connect a GitHub PR to this issue, but the bug-tracking is giving me error 500 :-(

So the PR is here:

https://github.com/php/php-src/pull/3534
 [2018-09-18 12:55 UTC] kaplun at protonmail dot com
P.s.

Thanks cmb@php.net for the pointers!
 [2018-09-18 12:56 UTC] requinix@php.net
-Status: Not a bug +Status: Re-Opened
 [2018-09-18 13:35 UTC] cmb@php.net
Seems my quick assessment above was wrong.  I've just build with
`./configure --disable-all --disable-cgi --enable-debug
--enable-pcntl` and ext/pcntl is available for phpdbg (without the
PR).
 [2018-09-18 14:25 UTC] kaplun at protonmail dot com
... and my PR meanwhile failed on Travis.

So, do you thing pcntl is explicitly disabled for phpdbg by each distributor?
 [2018-09-18 15:22 UTC] cmb@php.net
> I am trying to connect a GitHub PR to this issue, but the
> bug-tracking is giving me error 500 :-(

Known issue[1], unfortunately still unresolved.

> ... and my PR meanwhile failed on Travis.

The build failure is unrelated to the pull request, and has been
fixed in the meantime[2].

> So, do you thing pcntl is explicitly disabled for phpdbg by each
> distributor?

Yes, I think so.  I'm not sure why, though.  There may be actual
issues with running pcntl under interactive phpdbg, but running
with -qrr might be fine (and should be supported if so).

[1] <https://bugs.php.net/bug.php?id=76079>
[2] <https://github.com/php/php-src/commit/2df91cb5190018e0340c869abd6dbda553a97acb>
 [2019-03-27 09:49 UTC] krakjoe@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2019-03-27 09:49 UTC] krakjoe@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed in 79f046f89e187312cec3715bffc1a8b101f57531, by merge of PR referenced here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 06:01:28 2024 UTC