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

WordPress Trac noreply at wordpress.org
Mon Jan 24 01:15:35 UTC 2022


#33058: $wp_filesystem->exists('') returns a wrong answer (when
FS_METHOD='ftpext').
----------------------------+---------------------
 Reporter:  Zdrobau         |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:
Component:  Filesystem API  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+---------------------

Comment (by mkox):

 I was able to see the problem @Zdrobau might have been experiencing here.
 The behavior for the different FS_METHOD values is inconsistent for
 wp_filesystem->exists(). This is due to  different implementations of the
 exists methods.

 In https://www.ietf.org/rfc/rfc959.txt page 32 you can see that the
 ftp_nlist is based on ftp_list. If that method receives an empty path, it
 will check the current working directory. So the ftpext implementation of
 exists may return true (maybe always for empty paths), but direct returns
 false.

 The exists method should never be called empty, yes. But exists should
 behave equally in both impls.

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


More information about the wp-trac mailing list