From 8233b751b24604d4c1f2cbdff1fcf1f8864c186c Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Fri, 19 Apr 2019 17:05:43 +0200 Subject: [PATCH] fix(dropdownfield): upgraded fields from 2.5 may crash Signed-off-by: Thierry Bugier --- inc/fields/dropdownfield.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/fields/dropdownfield.class.php b/inc/fields/dropdownfield.class.php index e192e1bb8..9b166d5b5 100644 --- a/inc/fields/dropdownfield.class.php +++ b/inc/fields/dropdownfield.class.php @@ -230,7 +230,11 @@ public static function getName() { public function isValid() { // If the field is required it can't be empty $itemtype = json_decode($this->fields['values'], true); - $itemtype = $itemtype['itemtype']; + if ($itemtype === null) { + $itemtype = $this->fields['values']; + } else { + $itemtype = $itemtype['itemtype']; + } $dropdown = new $itemtype(); if ($this->isRequired() && $dropdown->isNewId($this->value)) { Session::addMessageAfterRedirect(