[wp-trac] [WordPress Trac] #53318: FTPext method exists() returns always false for files!

WordPress Trac noreply at wordpress.org
Wed Jun 2 07:24:23 UTC 2021


#53318: FTPext method exists() returns always false for files!
--------------------------+-----------------------------
 Reporter:  arl1nd        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.7.2
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 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?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53318>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list