From: djgrrr+phpbugs at p2p-network dot net Operating system: Linux 2.6 PHP version: 5.2.1 PHP Bug Type: Streams related Bug description: file_get_context context parameter doesn't work
Description: ------------ On windows it works fine, but, with *nix and possibly *bsd, the context parameter to file_get_contents does absolutely nothing, meaning you can't change the method, submit post data, change the bind ip, etc, with file_get_contents(). The example shown in the docs does not work http://us3.php.net/manual/en/wrappers.http.php Reproduce code: --------------- <?php $postdata = http_build_query( array( 'var1' => 'some content', 'var2' => 'doh' ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); echo file_get_contents('http://www.p2p-network.net/vars.php', false, $context); ?> Expected result: ---------------- i expect the returned post array from this script to be populated, which it would be if you did an actually post query on http://www.p2p-network.net/vars.php if you run this from windows, it works fine and shows up like this: $_POST = array ( 'var1' => 'some content', 'var2' => 'doh', ); Actual result: -------------- if you try the same code on *nix you get an empty post array: $_POST = array ( ); and if you look at the $_SERVER array you can see that none of the context options did anything -- Edit bug report at http://bugs.php.net/?id=40849&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40849&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40849&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40849&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40849&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40849&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40849&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40849&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40849&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40849&r=support Expected behavior: http://bugs.php.net/fix.php?id=40849&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40849&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40849&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40849&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40849&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40849&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40849&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40849&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40849&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40849&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40849&r=mysqlcfg