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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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 May 03 04:01:32 2024 UTC