WordPress.org

Make WordPress Core

Changeset 33480


Ignore:
Timestamp:
07/29/2015 06:48:09 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.1 branch.

See #32279.

File:
1 edited

Legend:

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

    r33479 r33480  
    20632063        $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
    20642064
    2065         if ( $this->check_safe_collation( $query ) ) {
     2065        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    20662066            $this->check_current_query = false;
    20672067        }
     
    20962096        $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
    20972097
    2098         if ( $this->check_safe_collation( $query ) ) {
     2098        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    20992099            $this->check_current_query = false;
    21002100        }
     
    21372137     */
    21382138    public function get_col( $query = null , $x = 0 ) {
    2139         if ( $this->check_safe_collation( $query ) ) {
     2139        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    21402140            $this->check_current_query = false;
    21412141        }
     
    21692169        $this->func_call = "\$db->get_results(\"$query\", $output)";
    21702170
    2171         if ( $this->check_safe_collation( $query ) ) {
     2171        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
    21722172            $this->check_current_query = false;
    21732173        }
     
    26902690
    26912691            foreach ( array_keys( $data ) as $column ) {
    2692                 $data[ $column ]['value'] = $row["x_$column"];
     2692                if ( isset( $row["x_$column"] ) ) {
     2693                    $data[ $column ]['value'] = $row["x_$column"];
     2694                }
    26932695            }
    26942696        }
Note: See TracChangeset for help on using the changeset viewer.