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.

Built from https://develop.svn.wordpress.org/trunk@32515


git-svn-id: http://core.svn.wordpress.org/trunk@32485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-05-19 20:30:27 +00:00
parent 2a2e976501
commit 45d897d0e7
2 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32514'; $wp_version = '4.3-alpha-32515';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -2893,11 +2893,13 @@ class wpdb {
return; return;
if ( $this->use_mysqli ) { 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 ); $this->col_info[ $i ] = @mysqli_fetch_field( $this->result );
} }
} else { } 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 ); $this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );
} }
} }