[wp-trac] [WordPress Trac] #20193: wp_post_mime_type_where does not properly prefix table names
WordPress Trac
wp-trac at lists.automattic.com
Wed Mar 7 16:11:42 UTC 2012
#20193: wp_post_mime_type_where does not properly prefix table names
--------------------------+------------------------------------------------
Reporter: benbalter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.4
Severity: minor | Keywords: has-patch dev-feedback 2nd-opinion
--------------------------+------------------------------------------------
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.
Related: #19779 and #12750.
Steps to reproduce:
1. Add a filter to `posts_where` that joins wp_posts (e.g., attachment
:example-filter.php:ticket:19779)
2. Navigate to a post and attempt to insert an existing image from the
gallery via the media upload iframe
3. Receive an error message that `post_mime_type` is ambiguous
I propose that when no table alias is given, the function defaults to
`$wpdb->posts` to prevent ambiguity.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20193>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list