From 41e441834735dd094b6c0e9fec900d8677fb5b0e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 5 Sep 2014 10:48:09 -0500 Subject: [PATCH] forms: Fix crash adding user with selection field --- include/class.dynamic_forms.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 4a31eecd9..61142fdab 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -1198,7 +1198,9 @@ class SelectionField extends FormField { function to_php($value, $id=false) { if ($value === null && $id === null) return null; - if ($id && is_int($id)) + if ($value instanceof DynamicListItem) + $item = $value; + elseif ($id && is_int($id)) $item = DynamicListItem::lookup($id); # Attempt item lookup by name too if (!$item || ($value !== null && $value != $item->get('value'))) { -- GitLab