Make WordPress Core

Opened 21 months ago

Last modified 18 months ago

#56260 new defect (bug)

In case of missing primary key on wp_posts, Media uploader gives false feedback indicating folder permissions are missing, where in fact database structure is malformed.

Reported by: harryfear's profile harryfear Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Database Keywords:
Focuses: Cc:


Hi community,

Files won't upload to the media library and a misleading feedback is presented to the user (indicating there is an uploads/months/day permissions issue), where in fact the file is written successfully to disk – but WP can't write to the wp_posts database.

I stumbled upon this as part of #56259 whereby wp_posts missing primary key + A.I. attributes are not picked up by WordPress (even in its repair.php functionality).

The same happens with failed media uploads. The UI reports the failure to write to a folder. Whereas the AJAX response is an unhandled full-HTML page. The UI error is a mismatch from the server response.

Steps to reproduce:—

  • Break AutoIncrement and Primary Key for wp_posts (can happen through user misfortune or third-party plugin or failed migration).
  • Upload media
  • Failure notice reports disk permissions failure, whereas the issue is in fact the database structure issue.

Forgive haste on this write-up.

Change History (3)

#1 @SergeyBiryukov
21 months ago

  • Component changed from General to Media

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

18 months ago

#3 @antpb
18 months ago

  • Component changed from Media to Database

It seems this has bigger problems outside of media if the database is broken in this way. It may be an issue with the repair logic not catching the missing primary key.

Moving this to Database to ensure the right folks to verify can have visibility.

Note: See TracTickets for help on using tickets.