note 117935 added to function.pclose

From: Date: Thu, 03 Sep 2015 11:17:09 +0000
Subject: note 117935 added to function.pclose
Groups: php.notes 
Request: Send a blank email to php-notes+get-203615@lists.php.net to get a copy of this message
Regarding the return value: "Returns the termination status of the process that was run. In case of an error then -1 is returned. " and the note about the exit status: "pclose() is internally implemented using the waitpid(3) system call. To obtain the real exit status code the pcntl_wexitstatus() function should be used." The documentation of the return value is, at best, misleading. The function returns, as does proc_close(): * -1 on error, * WEXITSTATUS(status) if WIFEXITED(status) is true, or * status if WIFEXITED(status) is false, where status is the status parameter of waitpid(). This makes it impossible to differentiate between a relatively normal exit or a termination by signal, and reduces the value of the proc_close return code to a binary one (ok / something broke). This can be seen in proc_open_rsrc_dtor() in ext/standard/proc_open.c (PHP 5.4.44, 5.6.12). The note advising the use of pcntl_wexitstatus is plain wrong. One cannot use pcntl_wexitstatus because it already has been used. ---- Server IP: 72.52.91.14 Probable Submitter: 213.160.5.140 ---- Manual Page -- http://php.net/manual/en/function.pclose.php Edit -- https://master.php.net/note/edit/117935 Del: integrated -- https://master.php.net/note/delete/117935/integrated Del: useless -- https://master.php.net/note/delete/117935/useless Del: bad code -- https://master.php.net/note/delete/117935/bad+code Del: spam -- https://master.php.net/note/delete/117935/spam Del: non-english -- https://master.php.net/note/delete/117935/non-english Del: in docs -- https://master.php.net/note/delete/117935/in+docs Del: other reasons-- https://master.php.net/note/delete/117935 Reject -- https://master.php.net/note/reject/117935 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203615) next »