ID:               36905
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dbarrett at quinthar dot com
-Status:           Verified
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: *
 PHP Version:      4.4.2
 Assigned To:      simp
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.




Previous Comments:
------------------------------------------------------------------------

[2006-03-29 22:49:55] [EMAIL PROTECTED]

Re-opend as documentation problem.
That page needs makeover.

------------------------------------------------------------------------

[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/features.file-upload.put-method.php

------------------------------------------------------------------------

[2006-03-29 14:54:26] [EMAIL PROTECTED]

.

------------------------------------------------------------------------

[2006-03-29 14:54:03] [EMAIL PROTECTED]

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 ------------------
[EMAIL PROTECTED] www.XXXX.com]# cat myputfile.ext
testing 1, 2, [EMAIL PROTECTED] 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

Reply via email to