[wp-trac] [WordPress Trac] #64130: Type error in /wp-includes/class-wpdb.php
WordPress Trac
noreply at wordpress.org
Tue Oct 21 18:15:24 UTC 2025
#64130: Type error in /wp-includes/class-wpdb.php
--------------------------+-----------------------------
Reporter: joehorntw | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 6.8.3
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello,
I find an error message in my wordpress site.
{{{
TypeError:mysqli_num_fields(): Argument #1 ($result) must be of type
mysqli_result, false given
#0 /wp-includes/class-wpdb.php(3863): mysqli_num_fields
#1 /wp-includes/class-wpdb.php(3863): wpdb::load_col_info
#2 /wp-includes/class-wpdb.php(786): wpdb::__get
...
}}}
I think there should be a type check before callint mysqli_num_fields(),
such as:
{{{#!php
<?php
protected function load_col_info() {
if ( $this->col_info || !is_object( $this->result ) ) {
return;
}
$num_fields = mysqli_num_fields( $this->result );
for ( $i = 0; $i < $num_fields; $i++ ) {
$this->col_info[ $i ] = mysqli_fetch_field(
$this->result );
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64130>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list