Doc #54497 [NEW]: Note incorrect: proc_close() extracts "real" exit status

From: Date: Sat, 09 Apr 2011 01:32:03 +0000
Subject: Doc #54497 [NEW]: Note incorrect: proc_close() extracts "real" exit status
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6215@lists.php.net to get a copy of this message
From: Operating system: Unix PHP version: 5.3.6 Package: Documentation problem Bug Type: Documentation Problem Bug description:Note incorrect: proc_close() extracts "real" exit status 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 bug report at http://bugs.php.net/bug.php?id=54497&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54497&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54497&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54497&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54497&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54497&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54497&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54497&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54497&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54497&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54497&r=support Expected behavior: http://bugs.php.net/fix.php?id=54497&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54497&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54497&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54497&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54497&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54497&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54497&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54497&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54497&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54497&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54497&r=mysqlcfg

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