Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#64519 new defect (bug)

WP_Filesystem_FTP and WP_Filesystem_FTPext classes create orphaned temp/noise files

Reported by: lucianwpwhite's profile lucianwpwhite Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.9
Component: Filesystem API Keywords:
Focuses: Cc:

Description

The WP_Filesystem_FTP and WP_Filesystem_FTPext classes create temporary files during put_contents operations, but if the FTP connection is invalid or null, the method throws an exception without cleaning up the temp file, resulting in orphaned files in tmp.on busy sites you can easily end up with 100K files in matter of days not to mention the fact that the file name provided is not respected.

For example lets say you pass/var/www/html/wp-content/uploads/plugin/index.php

If ftp is not configured you will end up with:/tmp/plugin-{random string}.php

And then the FTP will throw exception and the file will remain

Change History (1)

#1 @lucianwpwhite
4 weeks ago

If FTP is not configured you will end up with:/tmp/plugin-{random string}.tmp

sorry for the typo in the ticket description - I said the extension is .php but it's actually .tmp

Note: See TracTickets for help on using tickets.