I am working on a command line client (written in php, run by php-cli) and I'd like to use a password entry as in mysql client - with no echoing etc. I've found the function which I need:

      #include <unistd.h>
      char *getpass( const char * prompt );

But in man getpass it is marked as "This function is obsolete. Do not use it.". More from the manpage: "Present in SUSv2, but marked LEGACY. Removed in POSIX.1-2001."

Can this function be somehow included in next release of PHP, at least in coditional way so I can check its availability with function_exists? (a). Or I should patch my instance of PHP (b) or stick forever to a small binary written in C which then I call with backtick operator (c).

  What you recommend, developers of PHP ?

For one thing, I *don't* recommend wrapping obsoleted functions as a builtin. You're welcome to do this in an extension, it'll even be welcomed in PECL, but it's not something which belongs in the mainline distribution.

Note that since this function produces output (to stdout -- bypassing PHP's output layer), you may run into problems using this with any SAPI other than cgi or cli (not that you would use it elsewhere anyway), and it'll be completely out-of-band of any uses of ob_start() and family.

I also would be inclined to doubt that this integrates with PAM, so god help you if you're using a distributed authentication scheme such as LDAP, kerberos, etc...

Anyway, in case it wasn't obvious from my steadily darkening tone,
-1 from me.

-Sara

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to