[wp-trac] [WordPress Trac] #57765: mysqli_query call in wp-includes/wp-db.php generates fatal error during first run of WP with PHP 8.1

WordPress Trac noreply at wordpress.org
Sat Feb 18 17:28:18 UTC 2023


#57765: mysqli_query call in wp-includes/wp-db.php generates fatal error during
first run of WP with PHP 8.1
--------------------------+------------------------------
 Reporter:  lovingboth    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  6.1.1
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, welcome back to WordPress Trac! Thanks for the report.

 I could not reproduce the issue on PHP 8.2.3 or 8.1.16, the installation
 is completed as expected in my testing.

 The proposed line was already added to `wpdb::db_connect()` in [51582] /
 #52825, though it only runs if the `$use_mysqli` property is true. Some
 more information about the specific environment would be helpful here,
 specifically whether `WP_USE_EXT_MYSQL` is set in `wp-config.php`.

 > `PHP Fatal error: Uncaught mysqli_sql_exception: Table '[site-
 specific]wp_options' doesn't exist in /home/user/public_html/[site]/wp-
 includes/wp-db.php:2056`

 The version of WordPress would also be helpful. Line 2056 suggests
 WordPress 5.8 here, as that appears to be the last version with the
 [source:tags/5.8/src/wp-includes/wp-db.php?marks=2056#L2050 mysqli_query()
 call] on that line. In the later versions, the function call was moved
 around, and the whole file was renamed to `class-wpdb.php` for WordPress
 6.1 in [53749] / #56268.

 So if WordPress 5.8 is indeed used here, I would suggest testing with the
 latest version, as this would likely be fixed for WordPress 5.9 and later
 versions in [51582] / #52825.

 Possibly related: #51988.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57765#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list