# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /Applications/MAMP/htdocs/wordpress_develop/src/wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: date.php
--- date.php Base (BASE)
+++ date.php Locally Modified (Based On LOCAL)
@@ -153,30 +153,50 @@
 	}
 
 	/**
-	 * Validates a column name parameter.
+	 * Validates a column name parameter and prepends the appropriate $wpdb table name.
 	 *
 	 * @since 3.7.0
 	 * @access public
 	 *
 	 * @param string $column The user-supplied column name.
-	 * @return string A validated column name value.
+	 * @return string A validated column name value prepended by its $wpdb table name.
 	 */
 	public function validate_column( $column ) {
+		global $wpdb;
+
 		$valid_columns = array(
-			'post_date', 'post_date_gmt', 'post_modified',
-			'post_modified_gmt', 'comment_date', 'comment_date_gmt'
+			'post_date'         => $wpdb->posts,
+			'post_date_gmt'     => $wpdb->posts,
+			'post_modified'     => $wpdb->posts,
+			'post_modified_gmt' => $wpdb->posts,
+			'comment_date'      => $wpdb->comments,
+			'comment_date_gmt'  => $wpdb->comments,
 		);
+
 		/**
 		 * Filter the list of valid date query columns.
 		 *
 		 * @since 3.7.0
 		 *
-		 * @param array $valid_columns An array of valid date query columns. Defaults are 'post_date', 'post_date_gmt',
-		 *                             'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt'
+		 * @param array $valid_columns An array of valid date query columns, with the key being the column name and the value
+		 *                             being the table name. See $valid_columns in WP_Date_Query::validate_column() for the defaults;
 		 */
-		if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) )
+		$valid_columns = apply_filters( 'date_query_valid_columns', $valid_columns );
+
+		/**
+		 * Catch any filters implemented on date_query_valid_columns before #25775
+		 * https://core.trac.wordpress.org/ticket/25775
+		 */
+		if ( in_array( $column, array_values( $valid_columns ) ) ) {
+			return $column;
+		}
+		
+		if ( ! isset( $valid_columns[ $column ] ) ) {
 			$column = 'post_date';
+		}
 
+		$column = $valid_columns[ $column ] . '.' . $column;
+
 		return $column;
 	}
 
