Opened 13 years ago
Closed 13 years ago
#20022 closed defect (bug) (duplicate)
dbDelta() fails upgrading a table when DB prefix contains one or more capitalized letters
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.3.1 |
Component: | Database | Keywords: | needs-patch |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Duplicate of #19748.