Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#40694 new defect (bug)

dbDelta uses suppressed errors to detect table absence

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

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 7 years ago.

Download all attachments as: .zip

Change History (6)

@andy
7 years ago

#1 @andy
7 years ago

  • Keywords has-patch added

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


7 years ago

#3 @andy
7 years ago

This patch has been deployed on WordPress.com.

#4 @ocean90
7 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted

#5 @gaupoit
5 years ago

Query Monitor tool will collect this errors and showing them while the plugin creates custom tables using dbDelta function.

Note: See TracTickets for help on using tickets.