WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2016 12:18:49 AM (5 years ago)
Author:
pento
Message:

Database: Find the correct table names in DELETE queries with table aliases

Previously, wpdb::get_table_from_query() would not find the correct table name in the query DELETE a FROM table a, due to not recognising the table alias immediately after the DELETE as correct syntax.

Fixes #37660.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r38441 r38507  
    30303030                . '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?'
    30313031                . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?'
    3032                 . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?'
     3032                . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:.+?FROM)?'
    30333033                . ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) {
    30343034            return str_replace( '`', '', $maybe[1] );
Note: See TracChangeset for help on using the changeset viewer.