[wp-trac] [WordPress Trac] #28013: WP_Filesystem_FTPext::exists($filename) returns false when file exists on FTP Service ( IIS/6.0 Microsoft & Linux/vsftp ) (was: WP_Filesystem_FTPext::exists($filename) returns false when file exists on IIS/6.0 Microsoft FTP Service)

WordPress Trac noreply at wordpress.org
Fri Jul 10 03:27:39 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:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  3.9.2
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  administration
----------------------------+------------------------------

Comment (by jcroucher):

 This issue still exists but I am finding it on a Linux box using vsftp. I
 am getting this across multiple boxes.

 The issue is in

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

 {{{#!php
 public function exists($file) {
                 $list = @ftp_nlist($this->link, $path);

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

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

 The problem seems to be that ftp_nlist does not return . files, such as
 .maintenance
 This was causing the site to be stuck in maintenance mode after each
 update.

 I have fixed it by changing the ftp_nlist line to

 {{{#!php
 $list = @ftp_rawlist($this->link, "-al" .$file);
 }}}


 There are numerous posts on other forums mentioning the issue of ftp_nlist
 not returning hidden files.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28013#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list