[php-src] Issue #19969: Deprecate PHP_AUTH_USER, PHP_AUTH_PW, AUTH_TYPE in $_SERVER
| From: | kkmuffme | Date: | Thu, 25 Sep 2025 19:54:54 +0000 |
| Subject: | [php-src] Issue #19969: Deprecate PHP_AUTH_USER, PHP_AUTH_PW, AUTH_TYPE in $_SERVER | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250919@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19969
Author: kkmuffme
### Description
https://www.php.net/manual/en/features.http-auth.php
- PHP only supports "Basic" authentication, which is outdated - even the docs are
extremely old, talking about Internet Explorer...
- PHP does not populate those in CGI (e.g. php-fpm with nginx and there's no way to get it to
do that either for obvious reasons, and even in Apache it's behind a flag (CGIPassAuth)) -
which accounts probably for 90%+ of PHP web-traffic where it would make sense to use HTTP auth in
the first place
This led to some frameworks populating these manually in $_SERVER - however modifying that
superglobal is a bad practice in and of itself too
- the password being in plain-text in $_SERVER['PHP_AUTH_PW'] is unsafe, as it will leak
(e.g. error loggers,...)
- since they're in $_SERVER which can be modified in userland, they shouldn't be trusted
in the first place and filter_input should be used instead on the Authorization header
Therefore, I suggest to deprecate PHP_AUTH_USER, PHP_AUTH_PW, AUTH_TYPE in $_SERVER
I'm certain this needs an RFC, therefore I'd like to gather first feedback on this
proposal
### PHP Version
```plain
PHP 8.5
```
### Operating System
_No response_