[wp-trac] [WordPress Trac] #33058: $wp_filesystem->exists('') returns a wrong answer (when FS_METHOD='ftpext').
WordPress Trac
noreply at wordpress.org
Sun Mar 12 01:58:06 UTC 2023
#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: 2.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------
Changes (by costdev):
* keywords: has-patch dev-feedback => has-patch needs-testing
Comment:
After some testing, it appears that both the `FTPext` and `ftpsockets`
`::exists()` methods return `true` for an empty path.
[https://github.com/WordPress/wordpress-develop/pull/4224 PR 4224] updates
the `::exists()` methods for both `WP_Filesystem_FTPext` and
`WP_Filesystem_ftpsockets` to return `false` when passed `''`.
The PR uses a strict check on `''` rather than `empty()`, to prevent an
existing path of '0' returning `false`.
I've also attached a test plugin,
[https://core.trac.wordpress.org/attachment/ticket/33058/33058_test_filesystem_exists.zip
33058_test_filesystem_exists.zip], which shows the results for the
`direct`, `ftpext` and `ftpsockets` filesystem methods. **The test plugin
requires that you have an FTP server installed and running.**
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33058#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list