mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUG Fix incorrect enum string parsing
This commit is contained in:
parent
b7ac5c564d
commit
009f2de17c
@ -647,11 +647,11 @@ abstract class DBSchemaManager {
|
||||
// Update any records where the enum is set to a legacy value to be set to the default.
|
||||
foreach (array('enum', 'set') as $enumtype) {
|
||||
if (preg_match("/^$enumtype/i", $specValue)) {
|
||||
$newStr = preg_replace("/(^$enumtype\s*\(')|('$\).*)/i", "", $spec_orig);
|
||||
$new = preg_split("/'\s*,\s*'/", $newStr);
|
||||
$newStr = preg_replace("/(^$enumtype\\s*\\(')|('\\).*)/i", "", $spec_orig);
|
||||
$new = preg_split("/'\\s*,\\s*'/", $newStr);
|
||||
|
||||
$oldStr = preg_replace("/(^$enumtype\s*\(')|('$\).*)/i", "", $fieldValue);
|
||||
$old = preg_split("/'\s*,\s*'/", $oldStr);
|
||||
$oldStr = preg_replace("/(^$enumtype\\s*\\(')|('\\).*)/i", "", $fieldValue);
|
||||
$old = preg_split("/'\\s*,\\s*'/", $oldStr);
|
||||
|
||||
$holder = array();
|
||||
foreach ($old as $check) {
|
||||
|
@ -239,10 +239,9 @@ class MySQLSchemaManager extends DBSchemaManager {
|
||||
|
||||
public function fieldList($table) {
|
||||
$fields = $this->query("SHOW FULL FIELDS IN \"$table\"");
|
||||
$fieldList = array();
|
||||
foreach ($fields as $field) {
|
||||
|
||||
// ensure that '' is converted to \' in field specification (mostly for the benefit of ENUM values)
|
||||
$fieldSpec = str_replace('\'\'', '\\\'', $field['Type']);
|
||||
$fieldSpec = $field['Type'];
|
||||
if (!$field['Null'] || $field['Null'] == 'NO') {
|
||||
$fieldSpec .= ' not null';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user