WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#40694 new defect (bug)

dbDelta uses suppressed errors to detect table absence

Reported by: andy Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Database Keywords: has-patch
Focuses: Cc:
PR Number:

Description

In dbDelta, $tablefields is populated by the statement DESCRIBE {$table}. When the table does not exist, this statement fails with an error. This statement is executed with error suppression enabled.

Handling of suppressed errors is customizable in database drop-ins. In one large case, suppressed errors are logged for analysis. These suppressed DESCRIBE errors are considered a bug because it's possible to check for the presence of a table without errors by using a SHOW TABLES LIKE statement.

It would be preferable to leave error suppression out of dbDelta and use the SHOW TABLES LIKE statement, as in the attached patch.

Attachments (1)

b.diff (682 bytes) - added by andy 2 years ago.

Download all attachments as: .zip

Change History (5)

@andy
2 years ago

#1 @andy
2 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core-multisite by andy. View the logs.


2 years ago

#3 @andy
2 years ago

This patch has been deployed on WordPress.com.

#4 @ocean90
2 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted
Note: See TracTickets for help on using tickets.