Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to list directories/files #616

Open
jsakars opened this issue Jun 12, 2019 · 0 comments
Open

Unable to list directories/files #616

jsakars opened this issue Jun 12, 2019 · 0 comments
Assignees

Comments

@jsakars
Copy link

jsakars commented Jun 12, 2019

  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.

@PedroTroller PedroTroller self-assigned this Apr 5, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants