From 8983ddf0096a14cae483e0b2019dac78400a97d9 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Thu, 4 Apr 2019 14:20:00 +0200 Subject: [PATCH] fix: [enrichment] Testing if an object has attributes before looping over them --- app/Controller/EventsController.php | 6 ++++-- app/View/Events/resolved_misp_format.ctp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index aa36f510e..53e99c717 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -5110,8 +5110,10 @@ class EventsController extends AppController } else { $tmp_object['distribution'] = (int)$tmp_object['distribution']; } - foreach ($tmp_object['Attribute'] as &$tmp_attribute) { - $tmp_attribute = $this->__fillAttribute($tmp_attribute, $defaultDistribution); + if (isset($tmp_object['Attribute']) && $tmp_object['Attribute']) { + foreach ($tmp_object['Attribute'] as &$tmp_attribute) { + $tmp_attribute = $this->__fillAttribute($tmp_attribute, $defaultDistribution); + } } array_push($objects, $tmp_object); } diff --git a/app/View/Events/resolved_misp_format.ctp b/app/View/Events/resolved_misp_format.ctp index ce065f06d..d640a1543 100644 --- a/app/View/Events/resolved_misp_format.ctp +++ b/app/View/Events/resolved_misp_format.ctp @@ -120,7 +120,10 @@ ?> - + @@ -135,7 +138,6 @@ $attribute) { echo ''; echo '';
' . h($attribute['object_relation']) . '