[wp-trac] [WordPress Trac] #28013: WP_Filesystem_FTPext::exists($filename) returns false when file exists on FTP Service ( IIS/6.0 Microsoft & Linux/vsftp )
WordPress Trac
noreply at wordpress.org
Fri Aug 21 08:18:34 UTC 2015
#28013: WP_Filesystem_FTPext::exists($filename) returns false when file exists on
FTP Service ( IIS/6.0 Microsoft & Linux/vsftp )
----------------------------+-----------------------------
Reporter: joostdekeijzer | Owner: dd32
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 4.4
Component: Filesystem API | Version: 3.9.2
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
----------------------------+-----------------------------
Comment (by dd32):
Thanks for the feedback @mmucklo!
> The reason it fails is that you're passing in a $file into a command
that seems to require a directory as it's argument. I may be wrong here,
however when I pass in dirname($file) into the former command, things work
fine.
When a file is presented, a FTP server that respects the protocol is
supposed to return information about that file (Ignore whatever the PHP
docs suggest here), unfortunately there are a number of FTP servers out
there which obviously do not conform to spec.
The alternative solution, as you suggest, is to list the contents of the
directory above it to determine if the file is present.
Can you try switching out the exists method for this one?
{{{
public function exists( $file ) {
$path = dirname( $file );
$filename = basename( $file );
$file_list = @ftp_nlist( $this->link, '-a ' . $path );
return $list && in_array( $filename, $file_list );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28013#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list