Gaufrette icon indicating copy to clipboard operation
Gaufrette copied to clipboard

Fix for the isDir function in the FTP Adapter

Open Romain opened this issue 5 years ago • 4 comments

The isDir function seems to be broken in the FTP Adapter. When I try to retrieve a document through a stream, I get this error: ftp_chdir(): /documents/your-file-name.jpg: No such file or directory

Here is the complete trace:

in vendor/knplabs/gaufrette/src/Gaufrette/StreamWrapper.php->stat (line 210) 
in vendor/knplabs/gaufrette/src/Gaufrette/Stream/InMemoryBuffer.php->isDirectory (line 159) 
in vendor/knplabs/gaufrette/src/Gaufrette/Filesystem.php->isDirectory (line 333)
in vendor/knplabs/gaufrette/src/Gaufrette/Adapter/Ftp.php->isDir (line 222)
in vendor/knplabs/gaufrette/src/Gaufrette/Adapter/Ftp.phpftp_chdir (line 369)
in vendor/knplabs/gaufrette/src/Gaufrette/Adapter/Ftp.php (line 369)

Changing the way we perform this test by using the PHP function is_dir instead of the ftp_chdir one fixes this error.

Romain avatar Apr 30 '19 10:04 Romain

@nicolasmure I pushed a fix with your comments applied in it.

Romain avatar Jun 18 '19 19:06 Romain

@nicolasmure Got it. Pushed a change accordingly to your comment.

Romain avatar Jun 20 '19 07:06 Romain

Your comments have been integrated. These are nice improvements. ;)

Romain avatar Jun 21 '19 06:06 Romain

@nicolasmure I'm not sure how to update the tests since they're not checking the way we connect to the server.

Romain avatar Jul 26 '19 07:07 Romain