ID: 40574
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Feedback
Bug Type: Streams related
PHP Version: 5.2.1
New Comment:
Can't reproduce using vsftpd.
Previous Comments:
------------------------------------------------------------------------
[2007-03-05 13:48:52] [EMAIL PROTECTED]
Using proftpd with authentication fails
php > $c = stream_context_create(array("ftp" =>
array("overwrite"=>true)));
php > var_dump(file_put_contents("ftp://xx:[EMAIL PROTECTED]/data.txt",
"data", 0, $c));
Warning: file_put_contents(): Only 0 of 4 bytes written, possibly out
of free disk space in php shell code on line 1
------------------------------------------------------------------------
[2007-03-01 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-02-21 13:32:46] [EMAIL PROTECTED]
<?php
$c = stream_context_create(array("ftp" => array("overwrite"=>true)));
var_dump(file_put_contents("ftp://localhost/upload/data.txt", "data",
0, $c));
?>
outputs:
int(4)
Check your FTP server?
------------------------------------------------------------------------
[2007-02-21 10:06:48] [EMAIL PROTECTED]
I've ran an strace, here is the result
strace -e network php ftp.php
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(21),
sin_addr=inet_addr("192.168.20.13")}, 16) = -1 EINPROGRESS (Operation
now in progress)
I'd like to add that using the ftp extension works properly
(ftp_connect(), ftp_login(), ftp_put() sequence)
------------------------------------------------------------------------
[2007-02-21 10:03:58] [EMAIL PROTECTED]
Description:
------------
The ftp wrapper fails on writing operations. I tried
file_put_contents() with a stream context and overwrite set to true. I
tried using fopen() but it fails.
A file_get_contents() works properly though.
When looking at the network traffic I see the following:
port > ftp [SYN] ...
ftp > port [SYN, ACK] ...
port > ftp [RST] ...
I actually use 5.2.0 but this should not make any difference.
Reproduce code:
---------------
var_dump(file_put_contents('ftp://user:[EMAIL PROTECTED]/test.txt', 'fooo'));
PHP Warning: file_put_contents(): Only 0 of 4 bytes written, possibly
out of free disk space in php shell code on line 1
Warning: file_put_contents(): Only 0 of 4 bytes written, possibly out
of free disk space in php shell code on line 1
bool(false)
Expected result:
----------------
file created with the string as content.
Actual result:
--------------
Fails.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40574&edit=1