[wp-trac] [WordPress Trac] #19952: Passing an empty array into wp_get_object_terms results in an invalid query

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 3 05:12:27 UTC 2012


#19952: Passing an empty array into wp_get_object_terms results in an invalid query
--------------------------+-----------------------------
 Reporter:  batmoo        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Doing something like this:

 {{{wp_get_object_terms( array(), 'category' );}}}

 ...results in this:

 {{{
 WordPress database error: [You have an error in your SQL syntax; check the
 manual that corresponds to your MySQL server version for the right syntax
 to use near ') ORDER BY t.name ASC' at line 1]
 SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON
 tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON
 tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN
 ('category') AND tr.object_id IN () ORDER BY t.name ASC
 }}}

 {{{wp_get_object_terms}}} should catch and prevent this.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19952>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list