WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/06/2015 08:07:58 PM (5 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.7 branch.

props pento.
fixes #32104.

File:
1 edited

Legend:

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

    r32400 r32407  
    20812081        // We don't need to check the collation for queries that don't read data.
    20822082        $query = ltrim( $query, "\r\n\t (" );
    2083         if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN)\s/i', $query ) ) {
     2083        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) {
    20842084            return true;
    20852085        }
     
    22922292     */
    22932293    protected function strip_invalid_text_from_query( $query ) {
     2294        // We don't need to check the collation for queries that don't read data.
     2295        $trimmed_query = ltrim( $query, "\r\n\t (" );
     2296        if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
     2297            return $query;
     2298        }
     2299
    22942300        $table = $this->get_table_from_query( $query );
    22952301        if ( $table ) {
Note: See TracChangeset for help on using the changeset viewer.