$wpdb->suppress_errors() not supressing fatal errors during dbDelta()
After updating the "WP Offload Media" plugin I received this error
Fatal error: Uncaught mysqli_sql_exception: Table 'wordpress.wp_2217_as3cf_items' doesn't exist in /var/www/app/web/app/mu-plugins/ludicrousdb/ludicrousdb/includes/class-ludicrousdb.php:1481
I've tracked it down to a dbDelta() call where the following is being executed, which has been written to ignore failures by the looks of it, eg under the situation where the table doesn't exist, as dbDelta's job is to create or update db tables...
// Fetch the table column structure from the database.
$suppress = $wpdb->suppress_errors();
$tablefields = $wpdb->get_results( "DESCRIBE {$table};" );
$wpdb->suppress_errors( $suppress );
the fatal error is generated via the _do_query code in class-ludicrousdb.php
if ( true === $this->use_mysqli ) {
$result = mysqli_query( $dbh, $query );
} else {
$result = mysql_query( $query, $dbh );
}
and my "local fix" is to wrap the above in try/catch restoring the check on suppress_errors as crudely as I can think to do it
try {
if ( true === $this->use_mysqli ) {
$result = mysqli_query( $dbh, $query );
} else {
$result = mysql_query( $query, $dbh );
}
}
catch ( Throwable $exception ) {
if( $this->suppress_errors ) {
$result = false;
} else {
throw $exception;
}
}
I'm facing this issue also! The fix is not doing enough. Is there any additional fix in progress?
@thd-fox Given this project's last release was Dec 5, 2020 I think this one's dead 🤕
@dealer-solutions-gene Do you know any other $wpdb scaling replacement? Better than HyperDB or this one?