Bug #64841 [Opn]: ftp_put() returns FALSE for some 2xx FTP response codes

From: Date: Mon, 19 Mar 2018 17:06:09 +0000
Subject: Bug #64841 [Opn]: ftp_put() returns FALSE for some 2xx FTP response codes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214412@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64841&edit=1 ID: 64841 Updated by: cmb@php.net Reported by: ky dot patterson at adlinkr dot com Summary: ftp_put() returns FALSE for some 2xx FTP response codes Status: Open Type: Bug Package: FTP related Operating System: Linux PHP Version: 5.5.0RC1 Block user comment: N Private report: N New Comment: > Function ftp_put() should return TRUE (success) when it receives > any FTP response code in the 2xx range, or at the least should > return TRUE when it receives a standard FTP response code defined > in RFC 959 in the 2xx range. RFC 959 is pretty strict regarding Command-Reply Sequences[1]: | In this section, the command-reply sequence is presented. Each | command is listed with its possible replies; […] The only command where a 213 is listed as possible reply is the STAT command. I'm not sure whether we should be more liberal in what we accept. [1] <https://tools.ietf.org/html/rfc959#page-49> Previous Comments: ------------------------------------------------------------------------ [2013-05-15 00:43:29] ky dot patterson at adlinkr dot com Description: ------------ Function ftp_put() should return TRUE (success) when it receives any FTP response code in the 2xx range, or at the least should return TRUE when it receives a standard FTP response code defined in RFC 959 in the 2xx range. In particular it does not accept code 213 "File status" which is causing a problem for me. I checked the source for PHP v5.3.25 and 5.5.0RC1 and it is the same in both, any response other than 226 or 250 or 200 is considered a failure. Bug report 51190 indicates someone who had a similar problem with code 221. In response to that ticket, ftp_put() was changed to accept code 200, however this does not represent a general solution to the problem (and in fact did not solve bug 51190 either according to its reporter. Test script: --------------- $ftp = ftp_connect('ftp.nowhere.com'); ftp_login($ftp, 'username', 'password'); $result = ftp_put($ftp, 'remote_file.bin', 'local_file.bin', FTP_BINARY); /* STOR remote_file.bin 150 File status okay; about to open data connection. 216 closing data connection; File upload success; remote_file.bin */ Expected result: ---------------- 1) $result is TRUE 2) No error is triggered Actual result: -------------- 1) $result is FALSE 2) An error is triggered: ftp_put(): File status okay; about to open data connection ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64841&edit=1

« previous php.bugs (#214412) next »