Make WordPress Core

Opened 8 months ago

Last modified 8 months 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:


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!


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
8 months ago

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