Skip to content

Unable to list directories/files #616

Open
@jsakars

Description

@jsakars
  1. https://github.com/KnpLabs/Gaufrette/blob/master/src/Gaufrette/Adapter/Ftp.php#L127
  2. https://github.com/KnpLabs/Gaufrette/blob/master/src/Gaufrette/Adapter/Ftp.php#L240
  3. https://github.com/KnpLabs/Gaufrette/blob/master/src/Gaufrette/Adapter/Ftp.php#L383

In these 3x places, specific arguments like -al or -alR are being used when ftp_rawlist is being called.

I believe, depending on the FTP server settings, they cause trouble -> directories/files can not be listed and ftp_rawlist simply returns empty list.

Here is the code that does not list the files on the server (Hermes Germany carrier FTP - used by a lot of vendors of course) we use:

$adapter = new FtpAdapter($dir, $host, array(
    'port'     => 21,
    'username' => $user,
    'password' => $pass,
    'passive'  => false,
    'create'   => false,
    'mode'     => FTP_BINARY,
    'ssl'      => false,
));
$filesystem = new Filesystem($adapter);
var_dump($filesystem->keys());

And here is the native code which works as expected:

$connection = ftp_connect($host);

ftp_login($connection, $user, $pass);

var_dump(ftp_rawlist($connection, $dir));
// var_dump(ftp_rawlist($connection, '-alR ' . $dir)); // This is how Gaufrette does it

ftp_close($connection);

I believe this arguments must be configurable to resolve mentioned issue - they should be enabled by default to ensure backward compatibility but with an option to disable them.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions