From: jaswinder_rana at hotmail dot com
Operating system: WinXP
PHP version: 4.3.10
PHP Bug Type: *General Issues
Bug description: HTTP Authentication is not working. The login box keeps
popping.
Description:
------------
HTTP Authentication is not working. The login box keeps on coming back and
$_SESSION['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] are never intilized.
i spent 2 hours on it till i see there were same HTTP Authentication issue
with earlier PHP versions. I even upgraded to latest fixzes from
snaps.php.net and it di't still solve it.
I am using Apache 2.0.44 just in case its server's issue.
There are already issues but i din't see any with PHP4.3.10(and now after
updating from snaps.php.net PHP4.3.11)
so, i figured its good to mention so it can be fixed.
Reproduce code:
---------------
function error ($error_message)
{
echo $error_message."<BR>";
exit;
}
if ( (!isset($_SERVER['PHP_AUTH_USER'])) || $_SERVER['PHP_AUTH_USER']
!='user' || $_SERVER['PHP_AUTH_PW']!='pass')
{
header("WWW-Authenticate: Basic entrer=\"Admin\"");
header("HTTP/1.0 401 Unauthorized");
error("Unauthorized access...");
}
else
{
echo 'You are logged in..';
}
Expected result:
----------------
You are logged in..
Actual result:
--------------
Login box keeps on coming and it says $_SERVER['PHP_AUTH_PW'] undefined
index
--
Edit bug report at http://bugs.php.net/?id=31370&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31370&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31370&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31370&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31370&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31370&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31370&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31370&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31370&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31370&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31370&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31370&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31370&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31370&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31370&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31370&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31370&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31370&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31370&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31370&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31370&r=mysqlcfg