Opened 15 years ago
Closed 15 years ago
#19779 closed defect (bug) (fixed)
_edit_attachments_query_helper does not properly preface table name when querying unattached media
| Reported by: | benbalter | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | General | Version: | 3.3.1 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
Description
If a plugin modifies the media list on upload.php by joining wp_posts on itself (for example, to filter attachments which are children of a certain post type), MySQL throws an error when querying for unattached files because post_parent < 1 in _edit_attachments_query_helper is ambiguous without prefacing the table name (because of the join). All other columns in the query are explicitly named.
Steps to Reproduce:
- Hook into
posts_join_pagedonupload.phpand join wp_posts on itself ( e.g.,JOIN wp_posts wp_posts2 ON wp_posts2.post_parent = wp_posts.ID) - Navigate to media upload and query for unattached media
- Receive an error that
post_parentis ambiguous
Attachments (3)
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Preface table name