| bjori@php.net 2006-03-29, 6:58 pm |
| ID: 36905
Updated by: bjori@php.net
Reported By: dbarrett at quinthar dot com
-Status: Bogus
+Status: Verified
-Bug Type: HTTP related
+Bug Type: Documentation problem
-Operating System: Linux Fedora Core 3
+Operating System: *
PHP Version: 4.4.2
New Comment:
Re-opend as documentation problem.
That page needs makeover.
Previous Comments:
------------------------------------------------------------------------
[2006-03-29 21:17:33] dbarrett at quinthar dot com
Switching from "php://stdin" to "php://input" worked great, thanks!
Should the documentation be updated to reflect this? The 'Put Method
Support' documentation seems simply incorrect in light of this:
http://us3.php.net/manual/en/featur....put-method.php
------------------------------------------------------------------------
[2006-03-29 14:54:26] bjori@php.net
..
------------------------------------------------------------------------
[2006-03-29 14:54:03] bjori@php.net
STDIN/php://stdin is only set in php-cli, use php://input
...and read the warnings on http://php.net/manual/en/function.fread.php
------------------------------------------------------------------------
[2006-03-29 07:59:57] dbarrett at quinthar dot com
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 this bug report at http://bugs.php.net/?id=36905&edit=1
|