Skip to content

Commit fda096c

Browse files
committed
Ignore transaction rollback errors when an exception occurs
1 parent e961bf5 commit fda096c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,16 @@ public function query( string $query, $fetch_mode = PDO::FETCH_OBJ, ...$fetch_mo
535535
$this->execute_mysql_query( $ast );
536536
$this->commit();
537537
return $this->return_value;
538-
} catch ( Exception $err ) {
539-
$this->rollback();
538+
} catch ( Throwable $e ) {
539+
try {
540+
$this->rollback();
541+
} catch ( Throwable $rollback_exception ) {
542+
// Ignore rollback errors.
543+
}
540544
if ( defined( 'PDO_DEBUG' ) && PDO_DEBUG === true ) {
541-
throw $err;
545+
throw $e;
542546
}
543-
return $this->handle_error( $err );
547+
return $this->handle_error( $e );
544548
}
545549
}
546550

0 commit comments

Comments
 (0)