Date: 10/28/00
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #6730 Updated: doing a filelist on os390 with phps ftp-support doesn't return a result"
- Previous message: Daniel Beulshausen: "[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/printer php_printer.h printer.c printer.dsp /win32 php_modules.dsw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 7245
Updated by: sniper
Reported By: rxdev <email protected>
Status: Closed
Bug Type: FTP related
Assigned To:
Comments:
Fixed in CVS. Thank you for this very good bug report!
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-10-16 10:53:18] rxdev <email protected>
ftp_rawlist() bug:
-----------------
The function ftp_rawlist() is not properly working when you
want to list the current directory without naming it (i.e. 'LIST' command without parameters), e.g.
$arr=ftp_rawlist($fp,"")
is not working properly because PHP generates the command 'LIST ' (with supplemental space after LIST) which is NOT recognized by many ftp servers.
The empty path (that should mean "current directory") is absolutely necessary as:
* ftp_rawlist($fp,".") or ftp_rawlist($fp,"./") lists RECURSIVELY the directory on many ftpd servers : you can not use it to list the CWD
* rawlist($fp,<absolute path>) does NOT work with symlinks (the LIST <symlink> lists the symlink itself!) on many other ftpd servers
The only temporary trick to list the current directory in raw mode is to do a ftp_rawlist($fp,"-l") that generate a LIST -l
However, this is only a trick and therefore ftp_rawlist($fp,"") should be accepted
Here comes the reason of this bug, and the fix:
In ext/ftp/php_ftp.c you have the function PHP_FUNCTION(ftp_rawlist) defined, and this function calls the following subfunctions:
PHP_FUNCTION(ftp_rawlist)
-> llist = ftp_list(ftp, arg2->value.str.val);
-> ftp_list(ftpbuf_t *ftp, const char *path)
-> ftp_genlist(ftp, "LIST", path);
-> if (!ftp_putcmd(ftp, cmd, path))
-> this one has a BUG
The bug is located in file ext/ftp/ftp.c, function ftp_putcmd() :
int
ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
{
int size;
char *data;
/* build the output buffer */
if (args) {
/* "cmd argsrn
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #6730 Updated: doing a filelist on os390 with phps ftp-support doesn't return a result"
- Previous message: Daniel Beulshausen: "[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/printer php_printer.h printer.c printer.dsp /win32 php_modules.dsw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

