[wp-trac] [WordPress Trac] #40694: dbDelta uses suppressed errors to detect table absence

WordPress Trac noreply at wordpress.org
Mon May 8 20:00:38 UTC 2017


#40694: dbDelta uses suppressed errors to detect table absence
--------------------------+-----------------------------
 Reporter:  andy          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40694>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list