Req #43848 [Opn->Wfx]: Should be an option to disable echo when reading php://stdin
| From: | rasmus@php.net | Date: | Mon, 28 Feb 2011 23:47:27 +0000 |
| Subject: | Req #43848 [Opn->Wfx]: Should be an option to disable echo when reading php://stdin | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159118@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=43848&edit=1
ID: 43848
Updated by: rasmus@php.net
Reported by: graced at wingsnw dot com
Summary: Should be an option to disable echo when reading
php://stdin
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Irrelevant
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
This seems beyond what we should be supporting in the core of PHP. I am
sure
there are ways of doing this on Windows. A quick search gets me the
ScriptPW.Password component. It should be easy enough to trigger that
via the
COM extension.
eg.
$pwd = new Com('ScriptPW.Password');
Previous Comments:
------------------------------------------------------------------------
[2011-03-01 00:39:54] jgc at yahoo-inc dot com
Python supports a fxn for the password input use-case:
http://docs.python.org/py3k/library/getpass.html?highlight=password
Equivalent of that would satisfy me.
You can do the equivalent on unixy systems this way, but, alas, doesn't
work
on Windows, which many of our CLI script users have:
$stty =
stty -g;
system("stty -echo");
$input = trim(fgets(STDIN));
system("stty $stty");
------------------------------------------------------------------------
[2008-01-15 04:43:44] graced at wingsnw dot com
Description:
------------
Short of using an experimental extension that's not likely to be
available on a default install, there appears to be no way to
disable/enable echoing of stdin content when reading it.
A use case would be something like:
<?php
ob_implicit_flush(true);
echo "Please enter your password: ";
// code to disable echo here
$password = fgets(STDIN);
// code to re-enable echo here.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=43848&edit=1