From 932407a571798b4d29151e3d824685f534fe116f Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 17 Sep 2014 11:24:54 +0200 Subject: [PATCH] Fixed unserializing enum values --- src/Helpers/EnumHelper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Helpers/EnumHelper.php b/src/Helpers/EnumHelper.php index b0838655..1e21c471 100644 --- a/src/Helpers/EnumHelper.php +++ b/src/Helpers/EnumHelper.php @@ -82,9 +82,10 @@ class EnumHelper private static function stringToEnum($enumMap, $enumString) { $key = trim(strtolower($enumString)); - if (!isset($enumMap[$key])) + $lowerEnumMap = array_change_key_case($enumMap, \CASE_LOWER); + if (!isset($lowerEnumMap[$key])) throw new \DomainException('Unrecognized value: ' . $enumString); - return $enumMap[$key]; + return $lowerEnumMap[$key]; } }