Make WordPress Core

Opened 5 years ago

Last modified 19 months ago

#46146 new defect (bug)

dbDelta not parsing enum correctly

Reported by: janjakes's profile janjakes Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Database Keywords:
Focuses: Cc:

Description

Given an enum definition such as:

enum('a', 'b')

The dbDelta function parses it as:

enum('a',

Which causes a change to be detected on every execution. I'm also afraid other cases with spaces (like strings with spaces in enum values, etc.) will cause similar problem since the regular expressions in the dbDelta function seem to cover only some particular cases.

Change History (1)

#1 @rlorenzo
19 months ago

I found that having spaces is no longer an issue in newer versions of WordPress, but there is still a parsing issue with ENUMs if there are new lines between the elements. For example:

enum('a', 
'b',
'c'
)

This is a problem with WordPress 5.6.

Note: See TracTickets for help on using tickets.