|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32533 proc_get_status() - "running" always returns TRUE, even after process dead
Submitted: 2005-04-01 14:42 UTC Modified: 2005-04-08 01:08 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: chris at fragzzhost dot com Assigned:
Status: Closed Package: Program Execution
PHP Version: 5.* OS: Linux 2.6.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: chris at fragzzhost dot com
New email:
PHP Version: OS:


 [2005-04-01 14:42 UTC] chris at fragzzhost dot com
In the 5.0.4 release of PHP, the original proc_get_status bug (32210) doesn't appear to be fixed (Linux #1 SMP Tue Oct 12 08:27:04 CEST 2004 i686 i686 i386 GNU/Linux).

The "running" field now is always TRUE.

I know absolutely nothing about how this bit of code works, but I made the following change and it was fixed. Hopefully someone understands how this fluke works :)

Original code (note not as posted code)

                if (WIFSTOPPED(wstatus)) {
                        stopped = 1;
                        stopsig = WSTOPSIG(wstatus);
        } else {
                running = 0;

My dreadful change:
                if (WIFSTOPPED(wstatus)) {
                        stopped = 1;
                        stopsig = WSTOPSIG(wstatus);
        } else {
                running = 1;

I would also like to add that the original patch below doesn't appear to work correctly? Immediately after I kill the process manually with kill -9, running is FALSE as expected, but then if I sleep(2) then call proc_get_status() again, running is TRUE, and the process described isn't running.

Reproduce code:
(Best run from the command line)

$handle = proc_open("sleep 60", array(2 => array("pipe", "r")), $pipes);

$status = proc_get_status($handle);

(confirmed at this stage that process is still running by 'ps aux')

system('kill -9 '.$status['pid']);

$status = proc_get_status($handle);

Expected result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-01 14:46 UTC] chris at fragzzhost dot com
Looking at the original bug report and comparing it to the PHP source, there is a difference. The code supplied in the bug #32210 works properly whereas what's actually in PHP 5.0.4 doesn't.
 [2005-04-08 01:08 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 01:01:31 2024 UTC