Fix an additional case in duplication detection.

Prevents doubled options in some select-account widgets
This commit is contained in:
Nathan Gray 2014-04-17 21:47:13 +00:00
parent 31d36fb718
commit dac15dbded

View File

@ -237,9 +237,9 @@ class etemplate_widget_menupopup extends etemplate_widget
// so check here, as we re-index // so check here, as we re-index
// Duplicates might happen if app programmer isn't paying attention and // Duplicates might happen if app programmer isn't paying attention and
// either uses the same ID in the template, or adds the options twice // 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) if($value == $check_value)
{ {
foreach($options as $key => $existing) foreach($options as $key => $existing)