[wp-trac] [WordPress Trac] #46347: WP_Term_Query where sql_clauses oddity

WordPress Trac noreply at wordpress.org
Tue Feb 26 02:37:08 UTC 2019


#46347: WP_Term_Query where sql_clauses oddity
--------------------------+-----------------------------
 Reporter:  vrandom       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello, I was messing around with a customized version of the WP_Term_Query
 and noticed something odd.

 In the function get_terms, there are a lot of places where
 {{{$this->sql_clauses['where'][somekey]}}} variables are created.

 However, on line [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/class-wp-term-query.php#L642 643], this code :
 {{{#!php
 $where = implode( ' AND ', $this->sql_clauses['where'] );
 }}}
 only uses the first sub array value found and ignores all the other keys.

 Shouldn't this be:
 {{{#!php
 $where = implode( ' AND ', array_values($this->sql_clauses['where']));
 }}}
 so that all array elements are included in the where?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46347>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list