#50832 [NEW]: file_get_contents doesn't support passwordless HTTP authentication
| From: | sebastian at sebsoft dot nl | Date: | Mon, 25 Jan 2010 10:15:40 +0000 |
| Subject: | #50832 [NEW]: file_get_contents doesn't support passwordless HTTP authentication | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146905@lists.php.net to get a copy of this message | ||
From: sebastian at sebsoft dot nl
Operating system: Debian Lenny
PHP version: 5.3.1
PHP Bug Type: HTTP related
Bug description: file_get_contents doesn't support passwordless HTTP authentication
Description:
------------
When using file_get_contents, the function only seems to include HTTP
Authentication data when the password is set. When no password is set (e.g.
http://username@myurl.com), no authentication data is sent.
The result of
this is, when calling another PHP script with file_get_contents and only
supplying an HTTP username, $_SERVER['PHP_AUTH_USER'] is (unexpectedly) not
set.
We are using Apache 2.2 in this setup (for server.php).
$_SERVER['PHP_AUTH_USER'] does seem to be set when calling the same URL
using cURL or a browser.
Reproduce code:
---------------
client.php:
<?php
echo file_get_contents('http://testusername@hostname.tld/server.php');
?>
server.php:
<?php
if (isset($_SERVER['PHP_AUTH_USER']))
{
echo $_SERVER['PHP_AUTH_USER'];
}
else
{
echo "PHP AUTH USER not set";
}
?>
Expected result:
----------------
USER: testusername
Actual result:
--------------
PHP AUTH USER not set
--
Edit bug report at http://bugs.php.net/?id=50832&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50832&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50832&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50832&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50832&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50832&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50832&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50832&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50832&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50832&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50832&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50832&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50832&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50832&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50832&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50832&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50832&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50832&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50832&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50832&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50832&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50832&r=mysqlcfg