From 20e082d00e6390eeb1d2f4e00f6850127d9a1882 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 7 Dec 2013 12:18:58 +1300 Subject: [PATCH] Tidy up enum matching where classname is missing --- model/fieldtypes/Enum.php | 2 +- model/fieldtypes/MultiEnum.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/fieldtypes/Enum.php b/model/fieldtypes/Enum.php index e788baea9..c0b784bcc 100644 --- a/model/fieldtypes/Enum.php +++ b/model/fieldtypes/Enum.php @@ -38,7 +38,7 @@ class Enum extends StringField { public function __construct($name = null, $enum = NULL, $default = NULL) { if($enum) { if(!is_array($enum)) { - $enum = preg_split("/ *, */", trim($enum)); + $enum = preg_split("/ *, */", trim(trim($enum, ','))); } $this->enum = $enum; diff --git a/model/fieldtypes/MultiEnum.php b/model/fieldtypes/MultiEnum.php index 7e7cf17b4..0ddb4bf57 100644 --- a/model/fieldtypes/MultiEnum.php +++ b/model/fieldtypes/MultiEnum.php @@ -18,7 +18,7 @@ class MultiEnum extends Enum { // Validate and assign the default $this->default = null; if($default) { - $defaults = preg_split('/ *, */',trim($default)); + $defaults = preg_split('/ *, */',trim(trim($default, ','))); foreach($defaults as $thisDefault) { if(!in_array($thisDefault, $this->enum)) { user_error("Enum::__construct() The default value '$thisDefault' does not match "