Edit report at http://bugs.php.net/bug.php?id=43848&edit=1

 ID:                 43848
 Comment by:         jgc at yahoo-inc dot com
 Reported by:        graced at wingsnw dot com
 Summary:            Should be an option to disable echo when reading
                     php://stdin
 Status:             Open
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   Irrelevant
 PHP Version:        5.2.5
 Block user comment: N
 Private report:     N

 New Comment:

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");


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to