[wp-trac] [WordPress Trac] #33058: $wp_filesystem->exists('') returns a wrong answer (when FS_METHOD='ftpext').

WordPress Trac noreply at wordpress.org
Thu Mar 16 16:13:07 UTC 2023


#33058: $wp_filesystem->exists('') returns a wrong answer (when
FS_METHOD='ftpext').
-----------------------------------------------+---------------------------
 Reporter:  Zdrobau                            |       Owner:
                                               |  SergeyBiryukov
     Type:  defect (bug)                       |      Status:  closed
 Priority:  normal                             |   Milestone:  6.3
Component:  Filesystem API                     |     Version:  2.5
 Severity:  normal                             |  Resolution:  fixed
 Keywords:  has-patch has-testing-info commit  |     Focuses:
-----------------------------------------------+---------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55556" 55556]:
 {{{
 #!CommitTicketReference repository="" revision="55556"
 Filesystem API: Return `false` for empty paths in FTP `::exists()`
 methods.

 When `ftp_nlist()` receives an empty path, it checks the current working
 directory and may return `true`.

 This affects:
 * `WP_Filesystem_FTPext::exists()`
 * `WP_Filesystem_ftpsockets::exists()`

 As the purpose of the API is to provide a consistent interface for various
 filesystem implementations, this commit updates the affected methods to
 returns `false` when an empty path is provided, bringing consistency with
 the other filesystem abstraction classes, specifically
 `WP_Filesystem_Direct` and `WP_Filesystem_SSH2`.

 Follow-up to [6779], [11821], [25274], [31815].

 Props mkox, costdev, Zdrobau, dd32, pbiron, azaozz, mukesh27,
 SergeyBiryukov.
 Fixes #33058.
 }}}

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


More information about the wp-trac mailing list