Opened 14 years ago
Closed 14 years ago
#19952 closed defect (bug) (fixed)
Passing an empty array into wp_get_object_terms results in an invalid query
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.4 | Priority: | normal |
| Severity: | normal | Version: | 3.3.1 |
| Component: | General | Keywords: | has-patch |
| Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Attached patch checks for empty ids and taxonomies passed in and returns an empty array.