From 5559a51bccae19c3b032a3fe17e08047a67aacf8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Wed, 16 Dec 2020 18:20:29 +0200 Subject: [PATCH 1/2] Fix ftp_nlist for empty folders return false --- lib/internal/Magento/Framework/Filesystem/Io/Ftp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index 04df5fd3f3a6c..4bd3e49485681 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -313,9 +313,10 @@ public function chmod($filename, $mode) */ public function ls($grep = null) { - $ls = @ftp_nlist($this->_conn, '.'); + $ls = @ftp_nlist($this->_conn, '.') ?? []; $list = []; + foreach ($ls as $file) { $list[] = ['text' => $file, 'id' => $this->pwd() . '/' . $file]; } From c42d022322d7e6114d6a8cd4b7029adc5e44022a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Wed, 16 Dec 2020 18:27:40 +0200 Subject: [PATCH 2/2] Update Ftp.php --- lib/internal/Magento/Framework/Filesystem/Io/Ftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index 4bd3e49485681..0027329e7d54c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -313,7 +313,7 @@ public function chmod($filename, $mode) */ public function ls($grep = null) { - $ls = @ftp_nlist($this->_conn, '.') ?? []; + $ls = @ftp_nlist($this->_conn, '.') ?: []; $list = [];