From dac15dbded0fdd8b756fadec7e1f7dd193b0fbb9 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 17 Apr 2014 21:47:13 +0000 Subject: [PATCH] Fix an additional case in duplication detection. Prevents doubled options in some select-account widgets --- etemplate/inc/class.etemplate_widget_menupopup.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_menupopup.inc.php b/etemplate/inc/class.etemplate_widget_menupopup.inc.php index 2cea4eb12f..1806c1ce3e 100644 --- a/etemplate/inc/class.etemplate_widget_menupopup.inc.php +++ b/etemplate/inc/class.etemplate_widget_menupopup.inc.php @@ -237,9 +237,9 @@ class etemplate_widget_menupopup extends etemplate_widget // so check here, as we re-index // Duplicates might happen if app programmer isn't paying attention and // either uses the same ID in the template, or adds the options twice - if(is_numeric($value) && is_array($label) && !array_key_exists('value',$label)) + if(is_numeric($value) && (!is_array($label) || is_array($label) && !array_key_exists('value',$label))) { - $check_value = array_key_exists('value', $label) ? $label['value'] : $value; + $check_value = is_array($label) && array_key_exists('value', $label) ? $label['value'] : $value; if($value == $check_value) { foreach($options as $key => $existing)