WordPress.org

Make WordPress Core

Opened 12 days ago

Last modified 12 days ago

#53318 new defect (bug)

FTPext method exists() returns always false for files!

Reported by: arl1nd Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.7.2
Component: Filesystem API Keywords: needs-patch
Focuses: Cc:

Description

Hi there,

Are you aware that WP_Filesystem_FTPext method exists( $file ) only checks for existence of directory, giving file path as argument will always return false!

wp-admin/includes/class-wp-filesystem-ftpext.php

The original method code:

public function exists( $file ) {
	$list = ftp_nlist( $this->link, $file );

	if ( empty( $list ) && $this->is_dir( $file ) ) {
		return true; // File is an empty directory.
	}

	return ! empty( $list ); // Empty list = no file, so invert.
}

If you check the PHP manual for ftp_nlist it only accepts directory as input value.

Any thoughts?

Change History (1)

#1 @SergeyBiryukov
12 days ago

  • Component changed from General to Filesystem API
Note: See TracTickets for help on using tickets.