Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#49279 closed enhancement (fixed)

Missing spaces in parentheses in WP_Meta_Query::get_sql_for_clause()

Reported by: jillebehm's profile jillebehm Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.8 Priority: normal
Severity: trivial Version: 5.3.2
Component: Query Keywords: dev-feedback good-first-bug has-patch
Focuses: coding-standards Cc:

Description (last modified by SergeyBiryukov)

In /wp-includes/class-wp-meta-query.php on line 563 and 565 a space is missing between the opening parenthesis and $this->primary_table. This is not really a big thing, but the space is there in all the other code that use parentheses.

I noticed this when I tried to parse the JOIN statements mentioned in #49278, since I couldn't parse the correct 'words', because the parenthesis is now part of a 'word instead of a separate 'word'.

if ( 'LIKE' === $meta_compare_key ) {
	$join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key LIKE %s )", '%' . $wpdb->esc_like( $clause['key'] ) . '%' );
} else {
	$join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] );
}

Attachments (1)

49279.2.patch (1.1 KB) - added by kaavyaiyer 4 years ago.
Added missing spaces

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#2 @Hareesh Pillai
4 years ago

  • Keywords good-first-bug added

@kaavyaiyer
4 years ago

Added missing spaces

#3 @kaavyaiyer
4 years ago

  • Keywords has-patch added

Hi! I have added the missing spaces in /wp-includes/class-wp-meta-query.php. Please let me know if the changes look good.

#4 @Hareesh Pillai
4 years ago

Thanks for the patch @kaavyaiyer. The patch looks good to me.

#5 @Hareesh Pillai
4 years ago

  • Milestone changed from Awaiting Review to 5.8
  • Severity changed from normal to trivial

#6 @SergeyBiryukov
4 years ago

  • Summary changed from Missing spaces to Missing spaces in parentheses in WP_Meta_Query::get_sql_for_clause()

#7 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 50576:

Query: Consistently include a space in parentheses in WP_Meta_Query::get_sql_for_clause().

Props jillebehm, kaavyaiyer, hareesh-pillai.
Fixes #49279.

Note: See TracTickets for help on using tickets.