Ticket #21870: 21870.2.diff

File 21870.2.diff, 1.3 KB (added by ericlewis, 7 months ago)

As per the previous talk, forking open the discussed can of worms and removing the error control operator from mysql_query.

  • wp-includes/wp-db.php

     
    11921192                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) 
    11931193                        $this->timer_start(); 
    11941194 
    1195                 $this->result = @mysql_query( $query, $this->dbh ); 
     1195                $this->result = mysql_query( $query, $this->dbh ); 
    11961196                $this->num_queries++; 
    11971197 
    11981198                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) 
     
    12161216                        $return_val = $this->rows_affected; 
    12171217                } else { 
    12181218                        $num_rows = 0; 
    1219                         while ( $row = @mysql_fetch_object( $this->result ) ) { 
    1220                                 $this->last_result[$num_rows] = $row; 
    1221                                 $num_rows++; 
     1219                        if ( is_resource( $this->result ) ) { 
     1220                                while ( $row = mysql_fetch_object( $this->result ) ) { 
     1221                                        $this->last_result[$num_rows] = $row; 
     1222                                        $num_rows++; 
     1223                                } 
    12221224                        } 
    12231225 
    12241226                        // Log number of rows the query returned 
     
    15561558         * @access protected 
    15571559         */ 
    15581560        protected function load_col_info() { 
    1559                 if ( $this->col_info ) 
     1561                if ( $this->col_info || ! is_resource( $this->result ) ) 
    15601562                        return; 
    15611563 
    1562                 for ( $i = 0; $i < @mysql_num_fields( $this->result ); $i++ ) { 
    1563                         $this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i ); 
     1564                for ( $i = 0; $i < mysql_num_fields( $this->result ); $i++ ) { 
     1565                        $this->col_info[ $i ] = mysql_fetch_field( $this->result, $i ); 
    15641566                } 
    15651567        } 
    15661568