Make WordPress Core


Ignore:
Timestamp:
05/19/2015 08:29:30 PM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r32375 r32515  
    28942894
    28952895        if ( $this->use_mysqli ) {
    2896             for ( $i = 0; $i < @mysqli_num_fields( $this->result ); $i++ ) {
     2896            $num_fields = @mysqli_num_fields( $this->result );
     2897            for ( $i = 0; $i < $num_fields; $i++ ) {
    28972898                $this->col_info[ $i ] = @mysqli_fetch_field( $this->result );
    28982899            }
    28992900        } else {
    2900             for ( $i = 0; $i < @mysql_num_fields( $this->result ); $i++ ) {
     2901            $num_fields = @mysql_num_fields( $this->result );
     2902            for ( $i = 0; $i < $num_fields; $i++ ) {
    29012903                $this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );
    29022904            }
Note: See TracChangeset for help on using the changeset viewer.