php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54497 Note incorrect: proc_close() extracts "real" exit status
Submitted: 2011-04-09 03:32 UTC Modified: 2013-10-05 08:48 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: neo at nhng dot de Assigned: krakjoe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.6 OS: Unix
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: neo at nhng dot de
New email:
PHP Version: OS:

 

 [2011-04-09 03:32 UTC] neo at nhng dot de
Description:
------------
---
From manual page: http://www.php.net/function.proc-close#Notes
---
The Notes section on proc_close() incorrectly states that the status returned on Unix systems is the one returned by waitpid(3) and that pcntl_wexitstatus() should be used to extract the "real" exit status.

In fact WEXITSTATUS() is already called in proc_open_rsrc_dtor() (/ext/standard/proc_open.c:266) which in turn is called by proc_close() and therefore the "real" exit status is already extracted, even on Unix.

If however the user tried to extract the already extracted "real" exit status with pcntl_wexitstatus() the result will always be 0 because WEXITSTATUS(status) is defined as (((status) & 0xff00) >> 8) (at least on my system – Ubuntu Linux 10.10 x86_64)


This Bug is related to #53518 but there it is proposed to change the behaviour of proc_close() which could break many now working systems. I therefore propose to change the documentation to reflect the actual behaviour.

This behaviour has been that way since at least 4.4.4

Test script:
---------------
$process = proc_open("exit 1", array(), $pipes);
echo "Without pcntl_wexitstatus(): ", proc_close($process), "\n";
$process = proc_open("exit 1", array(), $pipes);
echo "With pcntl_wexitstatus(): ", pcntl_wexitstatus(proc_close($process)), "\n";

Expected result:
----------------
The note should be removed from the manual or should state which versions of PHP actually work this way.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-05 08:48 UTC] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&revision=331689
Log: #54497 remove outdated/incorrect information
 [2013-10-05 08:48 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2013-10-05 08:48 UTC] krakjoe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 15:00:01 2026 UTC