WordPress.org

Make WordPress Core

Ticket #8014: 8014.001.diff

File 8014.001.diff, 1.1 KB (added by AaronCampbell, 7 years ago)

Trims backticks from table and field names

  • trunk/wp-admin/includes/upgrade.php

     
    22/** 
    33 * WordPress Upgrade API 
    44 * 
    5  * Most of the functions are pluggable and can be overwritten  
     5 * Most of the functions are pluggable and can be overwritten 
    66 * 
    77 * @package WordPress 
    88 * @subpackage Administration 
     
    11191119        // Create a tablename index for an array ($cqueries) of queries 
    11201120        foreach($queries as $qry) { 
    11211121                if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { 
    1122                         $cqueries[strtolower($matches[1])] = $qry; 
     1122                        $cqueries[trim(strtolower($matches[1]), '`')] = $qry; 
    11231123                        $for_update[$matches[1]] = 'Created table '.$matches[1]; 
    11241124                } 
    11251125                else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { 
     
    11581158                                foreach($flds as $fld) { 
    11591159                                        // Extract the field name 
    11601160                                        preg_match("|^([^ ]*)|", trim($fld), $fvals); 
    1161                                         $fieldname = $fvals[1]; 
     1161                                        $fieldname = trim($fvals[1], '`'); 
    11621162 
    11631163                                        // Verify the found field name 
    11641164                                        $validfield = true;