Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#53455 closed defect (bug) (invalid)

WP:5.6 is Generating Zero-Sized files of previously deleted Media

Reported by: hiskingdomprophecy's profile HisKingdomProphecy Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.6
Component: Media Keywords:
Focuses: administration Cc:

Description

Hi Folks,

I should like to report a bug which came in the WP:5.6 on December 8, 2020. I became aware of earlier this month.

Since December 2020, WP has been generating hundreds of zero-sized files (0Kb) for media assets which have long since been removed from our posts and which no longer exist in the database, or which were the subjects of remote off-site linked assets.

Almost at random, it seems that WP is generating zero-sized files and placing them in the current year/month of wp-content/uploads/.

The number of files I have found and deleted to date are:
06 2021 55 Zero-size up to June 11
05 2021 196 Zero-size
04 2021 41 Zero-size
03 2021 82 Zero-size
02 2021 135 Zero-size
01 2021 182 Zero-size
12 2021 109 Zero-size
On June 11, I deleted all these above files, but new ones have been created as follows:
12th: 7, 13th: 2, 14th: 4, 15th: 2, 16th: 1, 17th: 0, 18th: 3, 19th: 2. Giving a total of 75 for 2021/06 to today.

The file types are mostly .jpg but also a few .mp3 and .pdf

I have been searching the database for source references for these deleted media files, and almost all can be found in the wp_postmeta table.

Some do not appear in the wp_postmeta table and I cannot find them in the database. I have no idea where they file name is hiding.

Based on the file names, I can recognise that some of these media files were loaded into posts which were then published, but then later the media was changed out and deleted from the post and from the database.
Some of the media files were loaded into WP draft posts and then deleted immediately.
Some of these media files were removed from posts 8-9 or more years ago, though most are more recent.

From my searching and from the names of the zero-sized media files generated ‘apparently randomly’ by WP, I believe they are related to old <img class wp-image-218493… links which were deletd from the posts when the media was deleted and new asset urls inserted.

However, these wp-image.medea-links still remain in the wp_postmeta table.

Since these files have zero-size, they don’t make a difference to the performance of the site, but in the wp-content/uploads/2021/05 directory 196 out of 313 items were zero-size files of media asset names which no longer exist on the site.

I would be pleased if your will look at this and see if you can find a fix.

I have a sample folder of for 2021/05&06 of these zero-sized files if you want to see it. Its size is 0Kb. Other than the file creation date, it contains no information I can see,
You can open it with Notepad as it only contains file names etc,
The 05-2021 list: https://www.dropbox.com/s/tprupg3qts8618a/05%20Blank%20files?dl=0
The 06-2021 lost: https://www.dropbox.com/s/z8iagzym3j1o2jl/06%20Blank%20files?dl=0
If you have any more questions, please do ask. I am pleased to help.

FYI. I am using the lasted WP and all plugins are up to date.

Regards and thanks,
Angus

Change History (3)

#1 @SergeyBiryukov
2 years ago

  • Keywords reporter-feedback added

Hi there, welcome back to WordPress Trac! Thanks for the report.

Does the issue still happen with all plugins disabled an a default theme (Twenty Twenty-One) activated?

#2 @HisKingdomProphecy
2 years ago

  • Resolution set to invalid
  • Status changed from new to closed

@SergeyBiryukov 

Thank you for your response.

The testing you suggested showed up nothing.

However, after analysis and other forms of testing, I have found (suspect) that preexisting class "wp-image-____" handling procedures in code in the Cloudinary plugin cause the generation of there zero-sized files, when the image asset is removed from the site/uploads/ and the Cloudinary/DB but that link is still live in the WP wp-postmeta table.

Thus, when we updated to WP:5.6 on December 8, 2020, the preexisting Cloudinary issue came to light and since that update, the plugin and WP have generated blank files with the names of the 'missing' assets' and drop them into the current /uploads/ dir.

AS a user, the root of the problem is that for me to modify the URL of any uploaded media asset, I need to first remove the class "wp-image-_____" link.

That allows me to change out linked asset url. It also allows me to stack images with no space between them, as the class "wp-image-____" seems to have undefined and unknown WP css attached to it, which shows up on phones, where a line of images of 6, are displayed in rows of 3&3.

So, with a class "wp-image-____" reference still in the DB wp-postmeta table, but not in any post, WP & Cloudinary solve the issue by generating - again and again - the necessary media asset, as a zero-sized file.

Since I use Cloudinary handle all of the images we display on our site, I have passed this to them to figure out.

Images and mdeia which we use once in a post use default settings and all contain a class "wp-image-____" link... and have no issues.

It is only those who's class "wp-image-____" link has been removed to add SEO to the file name or update an image url for some reason, that have this issue, and where that original asset url no longer related to an asset on our DB or Cloudinary's DB.

Sorry if this is a bit long winded, but this seems to be the root issue which Cloudinary need to work out and resolve.

If you want any further information on this, please just ask. Else, I will consider this issue closed as others are - I hope - working to resolve it.

Regards and thanks.
Angus

#3 @SergeyBiryukov
2 years ago

  • Keywords needs-patch reporter-feedback removed
  • Milestone Awaiting Review deleted

Thanks for the follow-up! Glad you were able to get to the bottom of it, and I appreciate the detailed response.

Note: See TracTickets for help on using tickets.