Bug #78717 [Opn]: pcntl_waitpid does not return process PID on child exit

From: Date: Tue, 22 Oct 2019 09:46:08 +0000
Subject: Bug #78717 [Opn]: pcntl_waitpid does not return process PID on child exit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223371@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78717&edit=1 ID: 78717 Updated by: nikic@php.net Reported by: simon at podlipsky dot net Summary: pcntl_waitpid does not return process PID on child exit Status: Open Type: Bug Package: PCNTL related Operating System: MacOS Catalina PHP Version: 7.3.10 Block user comment: N Private report: N New Comment: Works for me on Linux, likely MacOS specific. Previous Comments: ------------------------------------------------------------------------ [2019-10-22 09:36:30] simon at podlipsky dot net Description: ------------ pcntl_waitpid() always returns 0 on php 7.3 but on 7.2 it returns PID of exited child. Example call: $pid = pcntl_waitpid($procData['pid'], $status, WNOHANG); This is script linked below output on php 7.2.23: ``` /usr/local/Cellar/php@7.2/7.2.23/bin/php script.php Exiting child 0 unset child 0 ``` This is the output on php 7.3.10: ``` /usr/local/Cellar/php/7.3.10/bin/php script.php Exiting child 0 ``` On PHP 7.3 the script never ends and is stuck in infinite while loop because if ($res === $procData['pid']) expects PID to be assigned in $res on child exit but that never happens. Test script: --------------- https://gist.github.com/simPod/5a177947bdf864026bfc59d71d6e9d71 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78717&edit=1

« previous php.bugs (#223371) next »