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://usern...@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://testusern...@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

Reply via email to