From bf7fa167fadcd2495ca9145bd292df9ef16a814b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 16 Apr 2009 17:45:11 +0000 Subject: [PATCH] Handle backticks in dbDelta. Props AaronCampbell. fixes #8014 git-svn-id: https://develop.svn.wordpress.org/trunk@10948 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/upgrade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 01991106ac..13a1f6fe8b 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1185,7 +1185,7 @@ function dbDelta($queries, $execute = true) { // Create a tablename index for an array ($cqueries) of queries foreach($queries as $qry) { if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { - $cqueries[strtolower($matches[1])] = $qry; + $cqueries[trim( strtolower($matches[1]), '`' )] = $qry; $for_update[$matches[1]] = 'Created table '.$matches[1]; } else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { @@ -1224,7 +1224,7 @@ function dbDelta($queries, $execute = true) { foreach($flds as $fld) { // Extract the field name preg_match("|^([^ ]*)|", trim($fld), $fvals); - $fieldname = $fvals[1]; + $fieldname = trim( $fvals[1], '`' ); // Verify the found field name $validfield = true;