#40574 [Opn]: file_put_contents fails with ftp wrapper

From: Date: Wed, 21 Feb 2007 10:06:49 +0000
Subject: #40574 [Opn]: file_put_contents fails with ftp wrapper
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109244@lists.php.net to get a copy of this message
ID: 40574 User updated by: arnaud@php.net Reported By: arnaud@php.net Status: Open Bug Type: Streams related PHP Version: 5.2.1 New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [2007-02-21 10:03:58] arnaud@php.net 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:pass@host/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

« previous php.bugs (#109244) next »