[wp-trac] [WordPress Trac] #33470: wpdb class method get_table_from_query() malfunctions if table name contains a dash (-)
WordPress Trac
noreply at wordpress.org
Thu Aug 20 19:44:16 UTC 2015
#33470: wpdb class method get_table_from_query() malfunctions if table name
contains a dash (-)
--------------------------+-----------------------------
Reporter: dustinbolton | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The wpdb class in wp-db.php contains a method get_table_from_query() for
getting the table name from a passed query. This method as it stands does
not properly handle tables with a dash (-) in the table name, instead only
returning the table name characters up the point of the dash. This appears
to impact all query formats. Adding a dash (-) in three locations to the
regular expressions for the table name capture corrects this issue.
'''Examples:'''
{{{
get_table_from_query( "SHOW COLUMNS FROM wp_posts" );
}}}
Returns: wp_posts
{{{
get_table_from_query( "SHOW COLUMNS FROM wp-posts" );
}}}
Returns: wp
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33470>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list