[wp-trac] [WordPress Trac] #63173: FS_Method with ftpext and Core Updates
WordPress Trac
noreply at wordpress.org
Thu Mar 27 18:47:13 UTC 2025
#63173: FS_Method with ftpext and Core Updates
-------------------------------------------------+-------------------------
Reporter: SirLouen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Filesystem API | Version: trunk
Severity: major | Resolution:
Keywords: has-testing-info needs-testing dev- | Focuses:
feedback has-patch |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-testing-info has-patch => has-testing-info needs-testing
dev-feedback has-patch
Comment:
I've been researching, and it seems that ftp_nlist can be faulty when
working with numerous files or longer paths
https://stackoverflow.com/questions/66416395/php-ftp-nlist-returning-
false-when-retrieving-large-directory, specially if not using directory
navigation to short distances with `ftp_chdir`
The better alternative is to switch to `ftp_rawlist` which can handle
paths more conveniently.
Luckily, it seems that `ftp_nlist` is only used there.
https://github.com/WordPress/wordpress-
develop/blob/baab2b8f2273319817edede1b3360f212cf42241/src/wp-
admin/includes/class-wp-filesystem-ftpext.php#L427-L445
I've provided a patch for this. For performance purposes, we could still
use `ftp_nlist` under 2 directories, but thereafter, we should be using
`ftp_rawlist` for accuracy. Maybe even 3 directories.
I'm not sure how we could introduce some unit-tests apart from hard-coding
some mocks for the PHP ftp functions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63173#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list