Opened 4 years ago
Closed 4 years ago
#54769 closed enhancement (fixed)
INNER JOIN missing "AS" in /wp-includes/link-template.php
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Database | Keywords: | has-patch |
| Focuses: | Cc: |
Description
Line 1833 of /wp-includes/link-template.php reads ...
<?php $join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
... but I believe it should read ...
<?php $join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
It appears to be missing an "AS" after the second INNER JOIN.
Oliver
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
@domainsupport thanks for opening this ticket.
While
ASis an optional keyword in SQL, meaning that this isn't adefect (bug), it is commonly considered best practice to include theASkeyword for better readability and compatibility.To my knowledge, this doesn't fall under any of the official coding standards in WordPress, but this query and almost every other
INNER JOINthat uses aliases in Core includes theASkeyword - the one other exception I could find was insrc/wp-includes/taxonomy.php:2536.For the reason(s) above as well as consistency in Core, I think we should add the
ASkeyword in both of these files.Milestoning this for
6.0and marking as anenhancement.