From d50495e132e75324e050bab6f0110c1a5adf5b3a Mon Sep 17 00:00:00 2001 From: alimovdb Date: Wed, 26 Jul 2023 13:22:27 +0400 Subject: [PATCH 1/3] Update FtpAdapter.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix bug - League\Flysystem\UnableToListContents Unable to list contents for '', shallow listing Reason: League\Flysystem\Ftp\FtpAdapter::connection(): SSL_read on shutdown: error:0A000126:SSL routines::unexpected eof while reading at vendor/league/flysystem/src/UnableToListContents.php:17 13▕ { 14▕ $message = "Unable to list contents for '$location', " . ($deep ? 'deep' : 'shallow') . " listing\n\n" 15▕ . 'Reason: ' . $previous->getMessage(); 16▕ ➜ 17▕ return new UnableToListContents($message, 0, $previous); 18▕ } 19▕ 20▕ public function operation(): string 21▕ { --- FtpAdapter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FtpAdapter.php b/FtpAdapter.php index bdabfc7..6788cdf 100644 --- a/FtpAdapter.php +++ b/FtpAdapter.php @@ -94,10 +94,10 @@ private function connection() return $this->connection; } - if ($this->connectivityChecker->isConnected($this->connection) === false) { - $this->connection = false; - goto start; - } + // if ($this->connectivityChecker->isConnected($this->connection) === false) { + // $this->connection = false; + // goto start; + // } ftp_chdir($this->connection, $this->rootDirectory); From cf44f45cadb3dda87314581aba261748fa8a40ae Mon Sep 17 00:00:00 2001 From: "alimovdb@mail.ru" Date: Wed, 26 Jul 2023 15:23:00 +0400 Subject: [PATCH 2/3] fix problem --- FtpAdapter.php | 8 ++++---- NoopCommandConnectivityChecker.php | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/FtpAdapter.php b/FtpAdapter.php index 6788cdf..9d9045d 100644 --- a/FtpAdapter.php +++ b/FtpAdapter.php @@ -94,10 +94,10 @@ private function connection() return $this->connection; } - // if ($this->connectivityChecker->isConnected($this->connection) === false) { - // $this->connection = false; - // goto start; - // } + if ($this->connectivityChecker->isConnected($this->connection) === false) { + $this->connection = false; + goto start; + } ftp_chdir($this->connection, $this->rootDirectory); diff --git a/NoopCommandConnectivityChecker.php b/NoopCommandConnectivityChecker.php index fe43822..862b712 100644 --- a/NoopCommandConnectivityChecker.php +++ b/NoopCommandConnectivityChecker.php @@ -19,7 +19,8 @@ public function isConnected($connection): bool } // @codeCoverageIgnoreEnd - $responseCode = $response ? (int) preg_replace('/\D/', '', implode('', $response)) : false; + //$responseCode = $response ? (int) preg_replace('/\D/', '', implode('', $response)) : false; + $responseCode = $response ? (int) substr(implode('', $response), 0, 3) : false; return $responseCode === 200; } From 932055170e62a3ec8c4c308424d730e060e15d75 Mon Sep 17 00:00:00 2001 From: alimovdb Date: Wed, 26 Jul 2023 15:24:58 +0400 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8a2aea..e9e555f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ > ⚠️ this is a sub-split, for pull requests and issues, visit: https://github.com/thephpleague/flysystem ```bash -composer require league/flysystem-ftp +composer require dalimov/flysystem-ftp ``` View the [documentation](https://flysystem.thephpleague.com/docs/adapter/ftp/).