PHP 4.0 Bug #9043 Updated: popen returns a 'Resource id #' (non null) when process cannot be created.
| From: | stas@php.net | Date: | Tue, 06 Mar 2001 11:51:31 +0000 |
| Subject: | PHP 4.0 Bug #9043 Updated: popen returns a 'Resource id #' (non null) when process cannot be created. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-48019@lists.php.net to get a copy of this message | ||
ID: 9043
Updated by: stas
Reported By: sah@uow.edu.au
Old-Status: Open
Status: Closed
Bug Type: *Directory/Filesystem functions
Assigned To:
Comments:
popen runs "sh -c <your command>". This command does
succeed. The fact that sh was unable to run your command
should be checked by the pclose status.
Moreover, popen is pretty dangerous to use in PHP, since all
the I/O is buffered, and if the program exits before all the
output was written, you can easily get a SIGPIPE which will
kill your script.
Previous Comments:
---------------------------------------------------------------------------
[2001-02-01 13:48:19] bbonev@php.net
confirmed on linux both php4.0.3pl1 and latest CVS
---------------------------------------------------------------------------
[2001-02-01 00:16:30] sah@uow.edu.au
<?
$cp = popen('/bin/I_DO_NOT_EXIST', 'w');
echo "Result is $cp<br>n";
?>
Returns the following:
Result is Resource id #1
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9043&edit=2