#34401 [Opn]: $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of string

From: Date: Fri, 21 Oct 2005 09:28:27 +0000
Subject: #34401 [Opn]: $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86851@lists.php.net to get a copy of this message
ID: 34401 User updated by: lacak at users dot sourceforge dot net -Summary: $_SERVER["PHP_AUTH_DIGEST"] not set Reported By: lacak at users dot sourceforge dot net Status: Open Bug Type: Feature/Change Request Operating System: Win98 PHP Version: 5.1.0RC1 New Comment: Bug was fixed, but feature request remain ... Previous Comments: ------------------------------------------------------------------------ [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 http://bugs.php.net/?id=34401&edit=1

« previous php.bugs (#86851) next »