#50832 [Opn->Ver]: file_get_contents() doesn't support passwordless HTTP authentication
| From: | jani@php.net | Date: | Mon, 25 Jan 2010 16:12:06 +0000 |
| Subject: | #50832 [Opn->Ver]: file_get_contents() doesn't support passwordless HTTP authentication | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146915@lists.php.net to get a copy of this message | ||
ID: 50832
Updated by: jani@php.net
-Summary: file_get_contents doesn't support passwordless HTTP
authentication
Reported By: sebastian at sebsoft dot nl
-Status: Open
+Status: Verified
Bug Type: HTTP related
-Operating System: Debian Lenny
+Operating System: *
-PHP Version: 5.3.1
+PHP Version: 5.*, 6
Previous Comments:
------------------------------------------------------------------------
[2010-01-25 10:15:40] sebastian at sebsoft dot nl
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 this bug report at http://bugs.php.net/?id=50832&edit=1