[wp-trac] [WordPress Trac] #55414: Filter error suppression for individual DB query errors

WordPress Trac noreply at wordpress.org
Thu Mar 17 16:32:14 UTC 2022


#55414: Filter error suppression for individual DB query errors
-------------------------+-----------------------------
 Reporter:  bpayton      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  5.9.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Sometimes it is useful to suppress certain DB errors while logging others.

 For example, we have a set of standalone, core-like sites on WordPress.com
 where users can install arbitrary plugins and themes, and sometimes there
 are situations where query errors from third-party plugins flood a site's
 error logs. In some of those cases, the source of the error is not
 straightforward to address, and we would like to silence or throttle the
 errors so the site can continue using a given plugin without consuming its
 available disk space.

 Targeted suppression would be possible if WordPress supported a
 `suppress_query_error` filter that receives:
 * the current error suppression setting, defaulting to
 `$wpdb->suppress_errors`
 * the raw error string
 * the DB query associated with the error

 The result of filtering would determine whether `$wpdb->print_error()`
 returns early or logs the error, like `$wpdb->suppress_errors` does today.

 I have a patch for this and plan to submit a PR shortly after creating
 this ticket.

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


More information about the wp-trac mailing list