WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/21/2015 05:43:33 AM (5 years ago)
Author:
pento
Message:

WPDB: When deciding if a query needs extra sanity checking based on collation, return early when we can. Merges [32232] and [32233] to the 4.1 branch.

See #32029.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/tests/phpunit/tests/db/charset.php

    r32223 r32234  
    500500
    501501            $value[0] = "CREATE TABLE $this_table_name {$value[0]}";
    502             $value[2] = "SELECT * FROM $this_table_name";
     502            $value[2] = "SELECT * FROM $this_table_name WHERE a='\xf0\x9f\x98\x88'";
    503503            $value[3] = "DROP TABLE IF EXISTS $this_table_name";
     504            $value[4] = array(
     505                "SELECT * FROM $this_table_name WHERE a='foo'",
     506                "SHOW FULL TABLES LIKE $this_table_name",
     507                "DESCRIBE $this_table_name",
     508                "DESC $this_table_name",
     509                "EXPLAIN SELECT * FROM $this_table_name",
     510            );
    504511        }
    505512        unset( $value );
     
    513520     * @ticket 21212
    514521     */
    515     function test_table_collation_check( $create, $expected, $query, $drop ) {
     522    function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) {
    516523        self::$_wpdb->query( $drop );
    517524
     
    521528        $this->assertEquals( $expected, $return );
    522529
     530        foreach( $always_true as $true_query ) {
     531            $return = self::$_wpdb->check_safe_collation( $true_query );
     532            $this->assertTrue( $return );
     533        }
     534
    523535        self::$_wpdb->query( $drop );
    524536    }
Note: See TracChangeset for help on using the changeset viewer.