From: Operating system: Fedora 13 PHP version: 5.2.14 Package: Filesystem function related Bug Type: Bug Bug description:file_get_contents function can not set the HTTP headers
Description: ------------ My PHP is 5.2.13,if use under code <?php // Create a stream $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents('http://www.example.com/', false, $context); ?> use Wireshark check HTTP request header is: User-Agent: PHP/5.2.13\r\n Host: en.wikipedia.org\r\n Accept: */*\r\n I set header not exists Test script: --------------- <?php // Create a stream $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); Expected result: ---------------- User-Agent: PHP/5.2.13\r\n Host: en.wikipedia.org\r\n Accept-language: en\r\n Cookie: foo=bar\r\n Actual result: -------------- User-Agent: PHP/5.2.13\r\n Host: en.wikipedia.org\r\n Accept: */*\r\n -- Edit bug report at http://bugs.php.net/bug.php?id=52666&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52666&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52666&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52666&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52666&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52666&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52666&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52666&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52666&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52666&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52666&r=support Expected behavior: http://bugs.php.net/fix.php?id=52666&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52666&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52666&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52666&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52666&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52666&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52666&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52666&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52666&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52666&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52666&r=mysqlcfg