ID: 48285
Comment by: carsten_sttgt at gmx dot de
Reported By: me at andreylis dot ru
Status: Open
Bug Type: FTP related
Operating System: debian
PHP Version: 5.2.9
New Comment:
> 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
Previous Comments:
------------------------------------------------------------------------
[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