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:

<?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?


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

[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

Reply via email to