Ticket #38751: 38751.2.diff
File 38751.2.diff, 1.3 KB (added by , 8 years ago) |
---|
-
src/wp-includes/wp-db.php
3041 3041 if ( preg_match( '/^\s*(?:' 3042 3042 . 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' 3043 3043 . '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' 3044 . ')\W((?: [0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {3045 return str_replace( '`', '', $maybe[1] );3044 . ')\W((?:\\\\_|[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) { 3045 return str_replace( array( '`', '\\_' ), array( '', '_' ), $maybe[1] ); 3046 3046 } 3047 3047 3048 3048 // Big pattern for the rest of the table-related queries. -
tests/phpunit/tests/db.php
671 671 } 672 672 673 673 /** 674 * @ticket 38751 675 */ 676 function test_get_escaped_table_from_show_query() { 677 $query = "SHOW TABLES LIKE 'wp\_123\_foo'"; 678 $expected = 'wp_123_foo'; 679 680 $this->assertEquals( $expected, self::$_wpdb->get_table_from_query( $query ) ); 681 } 682 683 /** 674 684 * @ticket 21212 675 685 */ 676 686 function data_process_field_formats() {