mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if it's a query that will never return user data.
Fixes #32029. git-svn-id: https://develop.svn.wordpress.org/trunk@32232 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -505,6 +505,12 @@ class Tests_DB_Charset extends WP_UnitTestCase {
|
||||
$value[0] = "CREATE TABLE $this_table_name {$value[0]}";
|
||||
$value[2] = "SELECT * FROM $this_table_name";
|
||||
$value[3] = "DROP TABLE IF EXISTS $this_table_name";
|
||||
$value[4] = array(
|
||||
"SHOW FULL TABLES LIKE $this_table_name",
|
||||
"DESCRIBE $this_table_name",
|
||||
"DESC $this_table_name",
|
||||
"EXPLAIN SELECT * FROM $this_table_name",
|
||||
);
|
||||
}
|
||||
unset( $value );
|
||||
|
||||
@@ -516,7 +522,7 @@ class Tests_DB_Charset extends WP_UnitTestCase {
|
||||
* @dataProvider data_table_collation_check
|
||||
* @ticket 21212
|
||||
*/
|
||||
function test_table_collation_check( $create, $expected, $query, $drop ) {
|
||||
function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) {
|
||||
self::$_wpdb->query( $drop );
|
||||
|
||||
self::$_wpdb->query( $create );
|
||||
@@ -524,6 +530,11 @@ class Tests_DB_Charset extends WP_UnitTestCase {
|
||||
$return = self::$_wpdb->check_safe_collation( $query );
|
||||
$this->assertEquals( $expected, $return );
|
||||
|
||||
foreach( $always_true as $true_query ) {
|
||||
$return = self::$_wpdb->check_safe_collation( $true_query );
|
||||
$this->assertTrue( $return );
|
||||
}
|
||||
|
||||
self::$_wpdb->query( $drop );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user