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

From: Date: Tue, 22 Oct 2019 09:48:11 +0000
Subject: Bug #78717 [Com]: pcntl_waitpid does not return process PID on child exit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223372@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
 Comment by:         simon at podlipsky dot 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:

I forgot to specify, sorry. We tested on linux 7.3.10 and it went smoothly. Trying to find another
mac with 7.3 installed


Previous Comments:
------------------------------------------------------------------------
[2019-10-22 09:46:08] nikic@php.net

Works for me on Linux, likely MacOS specific.

------------------------------------------------------------------------
[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


Thread (9 messages)

« previous php.bugs (#223372) next »