#48285 [Opn->Bgs]: ftp_nlist fails

From: Date: Thu, 14 May 2009 21:48:03 +0000
Subject: #48285 [Opn->Bgs]: ftp_nlist fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-137337@lists.php.net to get a copy of this message
ID: 48285 Updated by: jani@php.net Reported By: me at andreylis dot ru -Status: Open +Status: Bogus Bug Type: FTP related Operating System: debian PHP Version: 5.2.9 New Comment: There are several things that might be going wrong: a) buggy ftp server b) firewall settings (see bug #47110) The above test script works fine for me as long as I replace the server with 'ftp.funet.fi' and directory with '/pub/gnu/gnu/commonc++' Previous Comments: ------------------------------------------------------------------------ [2009-05-14 21:17:19] carsten_sttgt at gmx dot de > if $directory contains '+' nothing is returned Maybe a problem with the FTP server? This script is working for me with PHP5.2.9/Windows/BSD: <?php $ftp_server = 'ftp.perl.org'; $ftp_user_name = 'anonymous'; $ftp_user_pass = 'guest'; $directory = '/pub/gnu/commonc++'; // contains '+' $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); $contents = ftp_nlist($conn_id, $directory); ftp_close($conn_id); var_dump($contents); ?> Regards, Carsten ------------------------------------------------------------------------ [2009-05-14 18:35:12] me at andreylis dot ru Description: ------------ hello ftp_nlist($connect, $directory) if $directory contains '+' nothing is returned Reproduce code: --------------- function ftpList ($hostname, $username, $password, $directory) { $connect = ftp_connect($hostname); $autorize = ftp_login($connect, $username, $password); $buff = ftp_nlist($connect, $directory); foreach ($buff as $element) { $size = ftp_size($connect, $element); if ($size < 0) { $type = "dir"; } else { $type = "file"; } $return[] = array("name" => $element, "size" => $size, "type" => $type); } sort($return); return $return; ftp_close($connect); } Expected result: ---------------- array with ftp names and sizes sorted by alphabet Actual result: -------------- nothing ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48285&edit=1

« previous php.bugs (#137337) next »