[wp-trac] [WordPress Trac] #20022: dbDelta() fails upgrading a table when DB prefix contains one or more capitalized letters

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 11 13:42:49 UTC 2012


#20022: dbDelta() fails upgrading a table when DB prefix contains one or more
capitalized letters
--------------------------+--------------------------------
 Reporter:  maxidirienzo  |      Owner:  dirienzo@…
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  3.3.1
 Severity:  normal        |   Keywords:  needs-patch
--------------------------+--------------------------------
 In line 1471:
 $cqueries[trim( strtolower($matches[1]), '`' )] = $qry;

 The table name is converted to lower case to be used as the array key,
 this array's key is later used for the alter table.... statements, which
 fails when mysql is configured to be case sensitive for tables names
 ("lower_case_table_names" system option) which usually differs from Unix
 to Windows servers.

 The bug appears when on these circumstances only:

 - MySql configured to be case sensitive on tables names
 - WordPress DB prefix contains at least one capital letter
 - dbDelta() is invoked with a CREATE TABLE statement and the table DOES
 EXISTS in the database

 Due to the strtolower in line 1471, the DESCRIBE (line 1494) that's being
 executed won't detect the table already exists and will try to run the
 CREATE TABLE instead of the ALTER TABLE to add each missing field.

 A proposed patch is attached.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20022>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list