Req #34401 [Fbk->NoF]: $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of string
| From: | php-bugs at lists dot php dot net | Date: | Sun, 29 Jan 2017 04:22:44 +0000 |
| Subject: | Req #34401 [Fbk->NoF]: $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207016@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=34401&edit=1
ID: 34401
Updated by: php-bugs@lists.php.net
Reported by: lacak at users dot sourceforge dot net
Summary: $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of
string
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: *General Issues
Operating System: Win98
PHP Version: 5.1.0RC1
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2017-01-20 20:42:05] heiglandreas@php.net
Is this still relevant?
------------------------------------------------------------------------
[2005-10-21 11:28:25] lacak at users dot sourceforge dot net
Bug was fixed, but feature request remain ...
------------------------------------------------------------------------
[2005-09-07 08:57:09] lacak at users dot sourceforge dot net
Description:
------------
in PHP 5.1 was introduced (in manual) new server variable $_SERVER["PHP_AUTH_DIGEST"].
But when i try use it, it seems not be initialized or set.
Today PHP_AUTH_DIGEST variable contains authentication string send by browser. Like this :
'Digest username="pokus", realm="www.realm.sk-0", qop="auth",
algorithm="MD5", ...'
My feature request is change it to associative array :
("explode" string into array like this :)
PHP_AUTH_DIGEST['username']='pokus'
PHP_AUTH_DIGEST['realm']='www.realm.sk-0'
PHP_AUTH_DIGEST['qop']='auth'
...
I think, that it is more user friendly solution.
Thank you very much.
Reproduce code:
---------------
<?php
//phpinfo();
//exit;
if (isset($_SERVER["AUTH_TYPE"]) || isset($_SERVER["PHP_AUTH_USER"])) {
echo "Case 1:<br />";
echo
$_SERVER["AUTH_TYPE"].":".$_SERVER["PHP_AUTH_USER"].":".$_SERVER["PHP_AUTH_PW"];
//print_r(apache_request_headers());
phpinfo();
exit;
}
if (isset($_SERVER["PHP_AUTH_DIGEST"])) {
echo "Case 2 (PHP_AUTH_DIGEST):<br />";
echo $_SERVER["AUTH_TYPE"].":".$_SERVER["PHP_AUTH_DIGEST"];
//print_r(apache_request_headers());
phpinfo();
exit;
}
if (!empty($_SERVER["REMOTE_IDENT"])) {
echo "Case 3:<br />";
echo $_SERVER["REMOTE_IDENT"];
//print_r(apache_request_headers());
phpinfo();
exit;
}
if (isset($_SERVER["HTTP_AUTHORIZATION"])) {
echo "Case 4 (HTTP_AUTHORIZATION):<br />";
echo "HTTP_AUTHORIZATION: ".$_SERVER["HTTP_AUTHORIZATION"];
//print_r(apache_request_headers());
phpinfo();
exit;
}
if (!empty($_SERVER["Authorization"])) {
echo "Case 5 (Authorization):<br />";
echo $_SERVER["Authorization"];
print_r(apache_request_headers());
phpinfo();
exit;
}
if (function_exists('apache_request_headers')) {
$headers=apache_request_headers();
if (isset($headers["Authorization"])) {
echo "Case 6:<br />";
echo $headers["Authorization"];
print_r(apache_request_headers());
phpinfo();
exit;
}
}
Header( "HTTP/1.0 401 Unauthorized");
Header( "WWW-Authenticate: Digest realm=\"www.realm.sk\",
opaque=\"opaque\", nonce=\"nonce\", stale=\"false\",
qop=\"auth\"");
Header( "WWW-Authenticate: Basic realm=\"www.realm.sk\"", false);
echo "K prístupu je potrebné zada platný login a heslo\n";
print_r(getallheaders());
exit;
?>
Expected result:
----------------
Case 2
Actual result:
--------------
Case 6 (if safe_mode=off) else recursive query for user name and password.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=34401&edit=1