Make WordPress Core


Ignore:
Timestamp:
05/06/2015 08:03:22 PM (9 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 4.0 branch.

props pento.
see #32104.

File:
1 edited

Legend:

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

    r32397 r32403  
    25022502        // We don't need to check the collation for queries that don't read data.
    25032503        $query = ltrim( $query, "\r\n\t (" );
    2504         if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN)\s/i', $query ) ) {
     2504        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) {
    25052505            return true;
    25062506        }
     
    27132713     */
    27142714    protected function strip_invalid_text_from_query( $query ) {
     2715        // We don't need to check the collation for queries that don't read data.
     2716        $trimmed_query = ltrim( $query, "\r\n\t (" );
     2717        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
     2718            return $query;
     2719        }
     2720
    27152721        $table = $this->get_table_from_query( $query );
    27162722        if ( $table ) {
Note: See TracChangeset for help on using the changeset viewer.