Make WordPress Core


Ignore:
Timestamp:
11/18/2014 03:37:23 AM (11 years ago)
Author:
pento
Message:

WPDB: When a db.php drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.

See #21212.

File:
1 edited

Legend:

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

    r30366 r30375  
    22122212
    22132213        foreach ( $columns as $column ) {
    2214             if ( $column->Collation ) {
     2214            if ( ! empty( $column->Collation ) ) {
    22152215                list( $charset ) = explode( '_', $column->Collation );
    22162216                $charsets[ strtolower( $charset ) ] = true;
     
    22382238        } elseif ( 0 === $count ) {
    22392239            // No charsets, assume this table can store whatever.
    2240             $charset = 'latin1';
     2240            $charset = false;
    22412241        } else {
    22422242            // More than one charset. Remove latin1 if present and recalculate.
     
    22922292        }
    22932293
     2294        // Skip this entirely if this isn't a MySQL database.
     2295        if ( false === $this->is_mysql ) {
     2296            return false;
     2297        }
     2298
    22942299        if ( empty( $this->table_charset[ $table ] ) ) {
    22952300            // This primes column information for us.
     
    23792384            $charset = $value['charset'];
    23802385
    2381             // latin1 will happily store anything.
    2382             if ( 'latin1' === $charset ) {
     2386            // Column isn't a string, or is latin1, which will will happily store anything.
     2387            if ( false === $charset || 'latin1' === $charset ) {
    23832388                continue;
    23842389            }
    23852390
    2386             // Column or value isn't a string.
    2387             if ( false === $charset || ! is_string( $value['value'] ) ) {
     2391            if ( ! is_string( $value['value'] ) ) {
    23882392                continue;
    23892393            }
Note: See TracChangeset for help on using the changeset viewer.