Opened 9 years ago
Last modified 6 years ago
#40694 new defect (bug)
dbDelta uses suppressed errors to detect table absence
| Reported by: |
|
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.
This patch has been deployed on WordPress.com.