Make WordPress Core


Ignore:
Timestamp:
02/06/2015 04:50:19 AM (8 years ago)
Author:
pento
Message:

WPDB: If a site is using the utf8 charset, and their version of MySQL supports utf8mb4, auto-upgrade them to utf8mb4.

This patch also resizes some indexes, to allow for the 767 byte index size limit in standard MySQL installs.

See #21212

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/db/charset.php

    r30699 r31349  
    131131
    132132    /**
    133      * @ ticket 21212
     133     * @ticket 21212
    134134     */
    135135    function test_process_fields_failure() {
    136136        global $wpdb;
    137         $data = array( 'post_content' => "H€llo\xf0\x9f\x98\x88World¢" );
     137        // \xf0\xff\xff\xff is invalid in utf8 and utf8mb4.
     138        $data = array( 'post_content' => "H€llo\xf0\xff\xff\xffWorld¢" );
    138139        $this->assertFalse( self::$_wpdb->process_fields( $wpdb->posts, $data, null ) );
    139140    }
     
    437438    function test_invalid_characters_in_query() {
    438439        global $wpdb;
    439         $this->assertFalse( $wpdb->query( "INSERT INTO {$wpdb->posts} (post_content) VALUES ('foo\xf0\x9f\x98\x88bar')" ) );
     440        $this->assertFalse( $wpdb->query( "INSERT INTO {$wpdb->posts} (post_content) VALUES ('foo\xf0\xff\xff\xffbar')" ) );
    440441    }
    441442}
Note: See TracChangeset for help on using the changeset viewer.