In `wpdb::load_col_info()`, don't fetch the number of fields in the result row on each iteration of the `for` loop. It can be stored in a var and referenced.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32515 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-05-19 20:29:30 +00:00
parent 6f4e407208
commit 6378cb5d60
1 changed files with 4 additions and 2 deletions

View File

@ -2893,11 +2893,13 @@ class wpdb {
return;
if ( $this->use_mysqli ) {
for ( $i = 0; $i < @mysqli_num_fields( $this->result ); $i++ ) {
$num_fields = @mysqli_num_fields( $this->result );
for ( $i = 0; $i < $num_fields; $i++ ) {
$this->col_info[ $i ] = @mysqli_fetch_field( $this->result );
}
} else {
for ( $i = 0; $i < @mysql_num_fields( $this->result ); $i++ ) {
$num_fields = @mysql_num_fields( $this->result );
for ( $i = 0; $i < $num_fields; $i++ ) {
$this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );
}
}