Make WordPress Core


Ignore:
Timestamp:
05/06/2015 08:01:59 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 4.1 branch.

props pento.
see #32104.

File:
1 edited

Legend:

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

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