Make WordPress Core


Ignore:
Timestamp:
05/06/2015 08:06:12 PM (11 years ago)
Author:
ocean90
Message:

WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.

Merges [32374] to the 3.8 branch.

props pento.
see #32104.

File:
1 edited

Legend:

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

    r32399 r32406  
    20892089        // We don't need to check the collation for queries that don't read data.
    20902090        $query = ltrim( $query, "\r\n\t (" );
    2091         if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN)\s/i', $query ) ) {
     2091        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) {
    20922092            return true;
    20932093        }
     
    23002300     */
    23012301    protected function strip_invalid_text_from_query( $query ) {
     2302        // We don't need to check the collation for queries that don't read data.
     2303        $trimmed_query = ltrim( $query, "\r\n\t (" );
     2304        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
     2305            return $query;
     2306        }
     2307
    23022308        $table = $this->get_table_from_query( $query );
    23032309        if ( $table ) {
Note: See TracChangeset for help on using the changeset viewer.