Doc #54497 [Opn->Csd]: Note incorrect: proc_close() extracts "real" exit status

From: Date: Sat, 05 Oct 2013 08:48:46 +0000
Subject: Doc #54497 [Opn->Csd]: Note incorrect: proc_close() extracts "real" exit status
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10424@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54497&edit=1 ID: 54497 Updated by: krakjoe@php.net Reported by: neo at nhng dot de Summary: Note incorrect: proc_close() extracts "real" exit status -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Unix PHP Version: 5.3.6 -Assigned To: +Assigned To: krakjoe Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2013-10-05 08:48:33] 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 ------------------------------------------------------------------------ [2011-04-09 03:32:02] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54497&edit=1

« previous php.doc.bugs (#10424) next »