diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 142ce5e4e5..6c4a86b9cd 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -964,14 +964,14 @@ class WP_Comment_Query { $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; - $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "{$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']}"; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); diff --git a/wp-includes/class-wp-network-query.php b/wp-includes/class-wp-network-query.php index e39f66a075..27ab483669 100644 --- a/wp-includes/class-wp-network-query.php +++ b/wp-includes/class-wp-network-query.php @@ -481,14 +481,14 @@ class WP_Network_Query { $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; - $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "{$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']}"; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index a826dda5ec..0f9ae28d5b 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3104,14 +3104,14 @@ class WP_Query { $found_rows = 'SQL_CALC_FOUND_ROWS'; } - $old_request = " - SELECT $found_rows $distinct $fields - FROM {$wpdb->posts} $join - WHERE 1=1 $where - $groupby - $orderby - $limits - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $old_request = + "SELECT $found_rows $distinct $fields + FROM {$wpdb->posts} $join + WHERE 1=1 $where + $groupby + $orderby + $limits"; $this->request = $old_request; @@ -3307,14 +3307,14 @@ class WP_Query { if ( $split_the_query ) { // First get the IDs and then fill in the objects. - $this->request = " - SELECT $found_rows $distinct {$wpdb->posts}.ID - FROM {$wpdb->posts} $join - WHERE 1=1 $where - $groupby - $orderby - $limits - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "SELECT $found_rows $distinct {$wpdb->posts}.ID + FROM {$wpdb->posts} $join + WHERE 1=1 $where + $groupby + $orderby + $limits"; /** * Filters the Post IDs SQL request before sending. diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php index bda2c0cb2a..fb3a6d22fe 100644 --- a/wp-includes/class-wp-site-query.php +++ b/wp-includes/class-wp-site-query.php @@ -695,14 +695,14 @@ class WP_Site_Query { $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; - $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "{$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']}"; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); diff --git a/wp-includes/class-wp-term-query.php b/wp-includes/class-wp-term-query.php index 04d86024be..25baaa8dd1 100644 --- a/wp-includes/class-wp-term-query.php +++ b/wp-includes/class-wp-term-query.php @@ -752,13 +752,13 @@ class WP_Term_Query { $this->sql_clauses['orderby'] = $orderby ? "$orderby $order" : ''; $this->sql_clauses['limits'] = $limits; - $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "{$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']}"; $this->terms = null; diff --git a/wp-includes/class-wp-user-query.php b/wp-includes/class-wp-user-query.php index b8b4733cf0..0d2c0dec86 100644 --- a/wp-includes/class-wp-user-query.php +++ b/wp-includes/class-wp-user-query.php @@ -818,13 +818,13 @@ class WP_User_Query { $this->results = apply_filters_ref_array( 'users_pre_query', array( null, &$this ) ); if ( null === $this->results ) { - $this->request = " - SELECT {$this->query_fields} - {$this->query_from} - {$this->query_where} - {$this->query_orderby} - {$this->query_limit} - "; + // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. + $this->request = + "SELECT {$this->query_fields} + {$this->query_from} + {$this->query_where} + {$this->query_orderby} + {$this->query_limit}"; $cache_value = false; $cache_key = $this->generate_cache_key( $qv, $this->request ); $cache_group = 'user-queries'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 5f0f90c765..71e059594d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta3-57749'; +$wp_version = '6.5-beta3-57750'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.