WordPress.org

Make WordPress Core

Changeset 33476


Ignore:
Timestamp:
07/29/2015 06:21:52 AM (5 years ago)
Author:
pento
Message:

WPDB: When checking the encoding of strings against the database, make sure we're only relying on the return value of strings that were sent to the database. Also make sure that we're not trying to sanity check strings that've been marked as not needing sanity checking.

Merge of [33455] to the 4.2 branch.

See #32279.

File:
1 edited

Legend:

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

    r33311 r33476  
    20822082        $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
    20832083
    2084         if ( $this->check_safe_collation( $query ) ) {
     2084        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    20852085            $this->check_current_query = false;
    20862086        }
     
    21152115        $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
    21162116
    2117         if ( $this->check_safe_collation( $query ) ) {
     2117        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    21182118            $this->check_current_query = false;
    21192119        }
     
    21562156     */
    21572157    public function get_col( $query = null , $x = 0 ) {
    2158         if ( $this->check_safe_collation( $query ) ) {
     2158        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    21592159            $this->check_current_query = false;
    21602160        }
     
    21882188        $this->func_call = "\$db->get_results(\"$query\", $output)";
    21892189
    2190         if ( $this->check_safe_collation( $query ) ) {
     2190        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    21912191            $this->check_current_query = false;
    21922192        }
     
    27142714
    27152715            foreach ( array_keys( $data ) as $column ) {
    2716                 $data[ $column ]['value'] = $row["x_$column"];
     2716                if ( isset( $row["x_$column"] ) ) {
     2717                    $data[ $column ]['value'] = $row["x_$column"];
     2718                }
    27172719            }
    27182720        }
Note: See TracChangeset for help on using the changeset viewer.