[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
Mon Jun 12 10:46:40 UTC 2023


#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:  Future Release
Component:  Filesystem API  |     Version:  3.9.2
 Severity:  normal          |  Resolution:
 Keywords:  close           |     Focuses:  administration
----------------------------+-----------------------------

Comment (by zippy1970):

 Why is this taking so long to fix? First it would be fixed in 6.0, then it
 was moved to 6.1, now we're in 6.2 and it still hasn't been fixed.

 In the meantime, each time I want to update my WordPress sites, I need to
 manually replace the exists() function with my own version - which, BTW
 works flawlessly:

 {{{#!php
 <?php
        public function exists( $file ) {
           $retval = false;

           $list = ftp_nlist( $this->link, $file );
           if( ! empty( $list ) ) {
             // if ftp_nlist returns *something*, the file or directory
 exists, on any FTP server
             $retval = true;
           } else {
             // if ftp_nlist returns nothing, either the file/dir doesn't
 exist or it's a file and
             // the FTP server's NLST command doesn't support globbing
 (i.e. Pure-FTPD > v1.0.47)
             // Check if it'a file
             if( ftp_size( $this->link, $file ) >= 0 ) {
               $retval = true;
             }
           }
           return $retval;

         }

 }}}

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


More information about the wp-trac mailing list