mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 22:56:19 +01:00
WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
Merges [32374] to the 3.7 branch. props pento. fixes #32104. Built from https://develop.svn.wordpress.org/branches/3.7@32407 git-svn-id: http://core.svn.wordpress.org/branches/3.7@32377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0697563967
commit
8cb1387688
@ -2080,7 +2080,7 @@ class wpdb {
|
||||
|
||||
// We don't need to check the collation for queries that don't read data.
|
||||
$query = ltrim( $query, "\r\n\t (" );
|
||||
if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN)\s/i', $query ) ) {
|
||||
if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2291,6 +2291,12 @@ class wpdb {
|
||||
* @return string|WP_Error The converted query, or a {@see WP_Error} object if the conversion fails.
|
||||
*/
|
||||
protected function strip_invalid_text_from_query( $query ) {
|
||||
// We don't need to check the collation for queries that don't read data.
|
||||
$trimmed_query = ltrim( $query, "\r\n\t (" );
|
||||
if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$table = $this->get_table_from_query( $query );
|
||||
if ( $table ) {
|
||||
$charset = $this->get_table_charset( $table );
|
||||
|
Loading…
Reference in New Issue
Block a user