Closed
Description
Description
After setting SIGCHLD, proc_get_status() returns unreliable exitcode values
On both el7 PHP 8.1.21 and el8 PHP 8.1.22, setting SIGCHLD to SIG_IGN results in proc_get_status returning exitcode -1. See https://stackoverflow.com/questions/71354900/php-proc-get-status-exitcode-is-always-1-after-pcntl-fork
On el8 PHP 8.1.22, setting SIGCHLD to a signal handler results in proc_get_status returning exitcode -1, but el7 PHP 8.1.21 works correctly.
#!/usr/bin/env php
<?php
function handleSIGCHLD($signo) {
}
//pcntl_signal(SIGCHLD, 'handleSIGCHLD');
pcntl_signal(SIGCHLD, SIG_IGN);
$proc = proc_open("/usr/bin/sleep 1", [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes);
do {
$status = proc_get_status($proc);
if (! $status['running'])
break;
usleep(300000);
} while (true);
echo "Exitcode: $status[exitcode]", PHP_EOL;
PHP Version
PHP 8.1.21 and PHP 8.8.22
Operating System
RHEL 8.8