Opened 14 years ago
Closed 14 years ago
#20193 closed defect (bug) (fixed)
wp_post_mime_type_where does not properly prefix table names
| Reported by: | benbalter | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Media | Version: | 3.4 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
Description
When called from the iframe media gallery, for example, wp_post_mime_type_where does not properly prefix the table name of post_mime_type in the WHERE clause, leading to a possible ambiguity if a plugin filters the media list by adding a join.
Steps to reproduce:
- Add a filter to
posts_wherethat joins wp_posts (e.g., attachment:example-filter.php:ticket:19779) - Navigate to a post and attempt to insert an existing image from the gallery via the media upload iframe
- Receive an error message that
post_mime_typeis ambiguous
I propose that when no table alias is given, the function defaults to $wpdb->posts to prevent ambiguity.
Attachments (1)
Change History (5)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Example resulting (erroneous) query: https://github.com/benbalter/WP-Document-Revisions/issues/3