Opened 13 years ago
Closed 12 years ago
#21272 closed defect (bug) (fixed)
reporting typo in dbDelta
Reported by: | apimlott | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | minor | Version: | 3.4.1 |
Component: | Database | Keywords: | has-patch |
Focuses: | Cc: |
Description
In dbDelta, there is the section:
// For every remaining index specified for the table foreach ( (array) $indices as $index ) { // Push a query line into $cqueries that adds the index to that table $cqueries[] = "ALTER TABLE {$table} ADD $index"; $for_update[$table.'.'.$fieldname] = 'Added index '.$table.' '.$index; }
Note that $for_update is updated with the wrong array index. This causes some updates not to be returned in $for_update. Better would be:
$for_update[$table.'.'.$index] = 'Added index '.$table.' '.$index;
Even this is not really right, since indexes and columns may have the same names. Given that the users of dbDelta don't even seem to care about the keys, it might be simpler just to change all the $for_update lines to
$for_update[] = ...
except for the first one that must be keyed on table name.
Attachments (2)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Now arbitrarily adds items to array, rather than clobbering the key in the loop. Patch added.