php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34401 $_SERVER["PHP_AUTH_DIGEST"] assoc array instead of string
Submitted: 2005-09-07 08:57 UTC Modified: 2017-01-29 04:22 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lacak at users dot sourceforge dot net Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.1.0RC1 OS: Win98
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lacak at users dot sourceforge dot net
New email:
PHP Version: OS:

 

 [2005-09-07 08:57 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-21 11:28 UTC] lacak at users dot sourceforge dot net
Bug was fixed, but feature request remain ...
 [2017-01-20 20:42 UTC] heiglandreas@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues
 [2017-01-20 20:42 UTC] heiglandreas@php.net
Is this still relevant?
 [2017-01-29 04:22 UTC] php-bugs at lists dot php dot net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 01:01:29 2024 UTC