From 744c165469c31b7f6d21085cbebcb21318f0d3ff Mon Sep 17 00:00:00 2001 From: Benn Oshrin Date: Sat, 1 Jan 2022 14:18:15 -0500 Subject: [PATCH] Another fix group type dereference in AttributeManager (NOJIRA) --- app/src/Lib/Match/AttributeManager.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/Lib/Match/AttributeManager.php b/app/src/Lib/Match/AttributeManager.php index 49c8f699e..ed13c5bcc 100644 --- a/app/src/Lib/Match/AttributeManager.php +++ b/app/src/Lib/Match/AttributeManager.php @@ -203,7 +203,16 @@ public function parseFromJSON(\stdClass $json) { // We have a set of objects of type $k. We group on type. foreach($v as $vobject) { // Group is default unless type is set - $g = !empty($vobject['type']) ? $vobject['type'] : '_default'; + $g = "_default"; + + // For some reason, $vobject is an array if it comes over the API, + // or an object if we get here via /matchgrids/reconcile. So for now + // at least we check both. + if(is_array($vobject) && !empty($vobject['type'])) { + $g = $vobject['type']; + } elseif(!empty($vobject->type)) { + $g = !empty($vobject->type); + } foreach($vobject as $vk => $vv) { if($vk == 'type') {