[wp-trac] [WordPress Trac] #42691: WP_Term_Query get_terms generates invalid sql queries

WordPress Trac noreply at wordpress.org
Fri Nov 24 16:55:13 UTC 2017


#42691: WP_Term_Query get_terms generates invalid sql queries
--------------------------+-----------------------------
 Reporter:  GM_Alex       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 {{{get_terms}}} at {{{WP_Term_Query}}} uses {{{$terms = array_map(
 'get_term', $terms );}}} but {{{get_term}}} can return {{{null}}} by
 definition and so we creating an array like the following one

 {{{#!php
 array(
   0 => null,
   1 => null
 )
 }}}

 As result {{{get_sql_for_clause}}} at {{{WP_Tax_Query}}} generates the
 invalid query, calling {{{$this->clean_query()}}} >
 {{{$this->transform_query()}}} > {{{WP_Term_Query::query()}}} and then
 {{{$terms = implode( ',', $terms )}}} at {{{get_sql_for_clause}}}.

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


More information about the wp-trac mailing list