Skip to content

FileSystem IO Ftp connection ls() method error for empty folders #31288

Closed
@Nazar65

Description

@Nazar65

Preconditions (*)

  1. Magento 2.4-develop
  2. Use the FTP connection by Magento\Framework\Filesystem\Io\Ftp

Regarding to the PHP documentation ftp_nlist() method can return as array and the false,
and in case of empty folder it returns false.

$ls = @ftp_nlist($this->_conn, '.');

Need to add additional check for the (false) case ad not put result of ftp_nlist() directly to the foreach loop

Steps to reproduce (*)

  1. Try to execute ls method of Magento\Framework\Filesystem\Io\Ftp::ls() on empty folder

Expected result (*)

  1. [Screenshots, logs or description]
    2.. empty array returned

Actual result (*)

  1. [Screenshots, logs or description]
  2. Exception Returned
    Invalid argument supplied for foreach() in vendor/magento/framework/Filesystem/Io/Ftp.php on line 319

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: Framework/FilesystemFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions