Avoid some 'array_key_exists() expects parameter 2 to be array' warnings by checking first

This commit is contained in:
nathangray 2020-10-13 15:20:33 -06:00
parent a0065835a6
commit 05ee7eba37
2 changed files with 2 additions and 2 deletions

View File

@ -89,7 +89,7 @@ class admin_cmd_customfield extends admin_cmd
unset($old['modified'], $old['modifier'], $old['tab']);
foreach($set as $key => $value)
{
if(array_key_exists($key, $old) && $old[$key] == $value)
if(is_array($old) && array_key_exists($key, $old) && $old[$key] == $value)
{
// Need to keep these 2 in set so we can tell if it was deleted
if(!in_array($key, array('id','name')))

View File

@ -332,7 +332,7 @@ class Customfields extends Transformer
);
foreach($defaults as $f => $d_value)
{
$widget->attrs[$f] = array_key_exists($f, $field['values']) ? $field['values'][$f] : $d_value;
$widget->attrs[$f] = is_array($field['values']) && array_key_exists($f, $field['values']) ? $field['values'][$f] : $d_value;
}
break;