Commit 8c4131f162 for wordpress.org
commit 8c4131f162247835aba2e58fd9da938c26e71ae0
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Sat Oct 17 23:22:50 2026 +0000
Database: Avoid a fatal error in `wpdb::load_col_info()` if the result is not set.
This resolves an error if `mysqli_num_fields()` is called before a successful SELECT-type query is performed:
{{{
mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, false given
}}}
Developed in https://github.com/WordPress/wordpress-develop/pull/13099.
Follow-up to r21472.
Props joehorntw, akshat2802, mukesh27, rejaulalomkhan, SergeyBiryukov.
Fixes #64130.
Built from https://develop.svn.wordpress.org/trunk@64458
git-svn-id: http://core.svn.wordpress.org/trunk@63608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wpdb.php b/wp-includes/class-wpdb.php
index 9537cdc57c..07bc04e28e 100644
--- a/wp-includes/class-wpdb.php
+++ b/wp-includes/class-wpdb.php
@@ -3951,7 +3951,7 @@ class wpdb {
* @since 3.5.0
*/
protected function load_col_info() {
- if ( $this->col_info ) {
+ if ( $this->col_info || ! $this->result instanceof mysqli_result ) {
return;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index dfb31fa088..84baf0bcf4 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64457';
+$wp_version = '7.2-alpha-64458';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.