#36905 [NEW]: PUT returns no data via php://stdin

From: Date: Wed, 29 Mar 2006 05:59:59 +0000
Subject: #36905 [NEW]: PUT returns no data via php://stdin
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95042@lists.php.net to get a copy of this message
From: dbarrett at quinthar dot com Operating system: Linux Fedora Core 3 PHP version: 4.4.2 PHP Bug Type: HTTP related Bug description: PUT returns no data via php://stdin Description: ------------ Reading from 'php://stdin' should produce the contents of the file uploaded via PUT, but nothing actually comes out. This is the same issue as described in bug #10383 (and marked as bogus), though it is anything but. Reproduce code: --------------- <?php $filename = "myputfile.ext"; $totalWritten = 0; $inFP = fopen( "php://stdin", "rb" ); $outFP = fopen( $filename, "wb" ); fwrite( $outFP, "testing 1, 2, 3" ); while( $data = fread( $inFP, 1024 ) ) { fwrite( $outFP, $data ); $totalWritten += strlen( $data ); } fclose($inFP); fclose($outFP); if( $totalWritten ) header( "HTTP/1.0 200 Success ($filename)" ); else header( "HTTP/1.0 404 Failed ($filename)" ); ?> Expected result: ---------------- I expected the test file to successfully upload, and the script to return 200 Success. Actual result: -------------- In actuality, the file does not upload. Rather, though it's able to open and write the test string to the file, it does not write any of the file contents itself. The actual command output follows: -------------- Client Side ------------------ D:\>type test Hello world! D:\>curl -i -T test http://www.XXXX.com/ HTTP/1.1 100 Continue HTTP/1.1 404 Failed (myputfile.ext) Date: Wed, 29 Mar 2006 07:17:03 GMT Server: Apache X-Powered-By: PHP/5.0.5 Content-Length: 1 Content-Type: text/html -------------- Server Side ------------------ [root@www www.XXXX.com]# cat myputfile.ext testing 1, 2, 3[root@www www.XXXX.com]# I've confirmed this identical behavior using both 'curl' and 'libcurl', on two different versions of Linux/Apache/PHP. -- Edit bug report at http://bugs.php.net/?id=36905&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36905&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36905&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36905&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36905&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36905&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36905&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36905&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36905&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36905&r=support Expected behavior: http://bugs.php.net/fix.php?id=36905&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36905&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36905&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36905&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36905&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36905&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36905&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36905&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36905&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36905&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36905&r=mysqlcfg

« previous php.bugs (#95042) next »