diff options
author | Nuno Lopes <nlopess@php.net> | 2006-12-01 16:34:43 +0000 |
---|---|---|
committer | Nuno Lopes <nlopess@php.net> | 2006-12-01 16:34:43 +0000 |
commit | 8e0cf441646af567924633452cdbd1af782cdaff (patch) | |
tree | 060421fe81c4c7b0e0d0315397f81cf4ceffef55 /ext/ftp | |
parent | 0742edb3969a92a710dc940ddb1d04be35e3cfe6 (diff) | |
download | php-git-8e0cf441646af567924633452cdbd1af782cdaff.tar.gz |
fix bug #39458: ftp_nlist() returns false on empty dirs
Diffstat (limited to 'ext/ftp')
-rw-r--r-- | ext/ftp/ftp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 99a953467e..a3601c0edd 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -1614,10 +1614,15 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) if (!ftp_putcmd(ftp, cmd, path)) { goto bail; } - if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) { + if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125 && ftp->resp != 226)) { goto bail; } + /* some servers don't open a ftp-data connection if the directory is empty */ + if (ftp->resp == 226) { + return ecalloc(1, sizeof(char**)); + } + /* pull data buffer into tmpfile */ if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) { goto bail; |