php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9043 popen returns a 'Resource id #' (non null) when process cannot be created.
Submitted: 2001-02-01 00:16 UTC Modified: 2001-03-06 06:51 UTC
From: sah at uow dot edu dot au Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 4.0.3pl1 OS: Solaris 8
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sah at uow dot edu dot au
New email:
PHP Version: OS:

 

 [2001-02-01 00:16 UTC] sah at uow dot edu dot au
<?

$cp = popen('/bin/I_DO_NOT_EXIST', 'w');

echo "Result is $cp<br>\n";

?>


Returns the following:

Result is Resource id #1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-01 13:48 UTC] bbonev@php.net
confirmed on linux both php4.0.3pl1 and latest CVS
 [2001-03-06 06:51 UTC] stas@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 01:01:28 2024 UTC