mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 17:44:25 +00:00
WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
See #32104. git-svn-id: https://develop.svn.wordpress.org/trunk@32374 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2531,7 +2531,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;
|
||||
}
|
||||
|
||||
@@ -2741,6 +2741,12 @@ class wpdb {
|
||||
* @return string|WP_Error The converted query, or a 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 );
|
||||
|
||||
Reference in New Issue
Block a user