From e6904bc0e818cd828c7acad05ec0c6086a91820c Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 28 Jul 2015 06:32:24 +0000 Subject: [PATCH] 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. Fixes #32279. Built from https://develop.svn.wordpress.org/trunk@33455 git-svn-id: http://core.svn.wordpress.org/trunk@33422 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 5415a135d8..14eebb4a68 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-beta4-33454'; +$wp_version = '4.3-beta4-33455'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index c480e46d68..9ce6519be1 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -2112,7 +2112,7 @@ class wpdb { public function get_var( $query = null, $x = 0, $y = 0 ) { $this->func_call = "\$db->get_var(\"$query\", $x, $y)"; - if ( $this->check_safe_collation( $query ) ) { + if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } @@ -2147,7 +2147,7 @@ class wpdb { public function get_row( $query = null, $output = OBJECT, $y = 0 ) { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; - if ( $this->check_safe_collation( $query ) ) { + if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } @@ -2188,7 +2188,7 @@ class wpdb { * @return array Database query result. Array indexed from 0 by SQL result row number. */ public function get_col( $query = null , $x = 0 ) { - if ( $this->check_safe_collation( $query ) ) { + if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } @@ -2222,7 +2222,7 @@ class wpdb { public function get_results( $query = null, $output = OBJECT ) { $this->func_call = "\$db->get_results(\"$query\", $output)"; - if ( $this->check_safe_collation( $query ) ) { + if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } @@ -2748,7 +2748,9 @@ class wpdb { } foreach ( array_keys( $data ) as $column ) { - $data[ $column ]['value'] = $row["x_$column"]; + if ( isset( $row["x_$column"] ) ) { + $data[ $column ]['value'] = $row["x_$column"]; + } } }