php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #3285 Cannot feed command stdin and get output, etc.
Submitted: 2000-01-22 17:29 UTC Modified: 2002-01-27 01:32 UTC
From: kop at meme dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kop at meme dot com
New email:
PHP Version: OS:

 

 [2000-01-22 17:29 UTC] kop at meme dot com
There is no way to execute a command, feed it stuff on standard in, retrive the return code, standard out, and standard error.  exec() should probably have two additional arguments, an array for the output sent to standard error, and a string to be passed to to the child on standard in.

I could always pass arguments to commands, instead of having them read from standard in.  However, this is not a good idea from a security standpoint as argument values are visible to anybody on the system.

In my particular case, I've got a specialized, suid root, password change program I'd like to invoke from php.  This program takes a password on standard in.  If I don't give up and use perl, I'll probably use popen() and output redirection to guarenteed unique file names in /tmp to capture stdout and stderr, along with an echo of $? to get the return code.  In my case this will probably work.  In the general case writing to the file system could be a security problem. Certainlly it's a big hassle.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 14:00 UTC] jimw@php.net
refiled against 4.0.
 [2002-01-27 01:32 UTC] sterling@php.net
popen() can do this fine (except for stderr), this won't be implemented in exec() though...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 21:01:30 2024 UTC