[wp-trac] [WordPress Trac] #30815: WP_Filesystem_FTPext::exists() returns false if directory exists but is empty

WordPress Trac noreply at wordpress.org
Wed Mar 18 19:21:34 UTC 2015


#30815: WP_Filesystem_FTPext::exists() returns false if directory exists but is
empty
----------------------------------------+----------------------
 Reporter:  Unyson                      |       Owner:  ocean90
     Type:  defect (bug)                |      Status:  closed
 Priority:  normal                      |   Milestone:  4.2
Component:  Filesystem API              |     Version:  2.8
 Severity:  normal                      |  Resolution:  fixed
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+----------------------
Changes (by ocean90):

 * owner:   => ocean90
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"31815"]:
 {{{
 #!CommitTicketReference repository="" revision="31815"
 WP_Filesystem: Change `WP_Filesystem_FTPext::exists()` and
 `WP_Filesystem_ftpsockets::exists()` to return true for empty directories.

 Both methods are using *nlist() which returns a list of files in a given
 directory or the file itself for a given file. If the result was an empty
 list we assumed that the file doesn't exists. This includes also cases
 where $file is actually an empty directory. To prevent this we now check
 if $file is a directory before returning the result of an empty list.
 Other filesystem methods are using `file_exists()` which already checks
 whether a file or directory exists.

 fixes #30815.
 }}}

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


More information about the wp-trac mailing list