Opened 17 months ago
Closed 17 months 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
AS
is an optional keyword in SQL, meaning that this isn't adefect (bug)
, it is commonly considered best practice to include theAS
keyword 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 JOIN
that uses aliases in Core includes theAS
keyword - 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
AS
keyword in both of these files.Milestoning this for
6.0
and marking as anenhancement
.