fix: [enrichment] Testing if an object has attributes before looping over them

pull/4584/head
chrisr3d 2019-04-04 14:20:00 +02:00
parent 67f8368490
commit 8983ddf009
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
2 changed files with 8 additions and 4 deletions

View File

@ -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);
}

View File

@ -120,7 +120,10 @@
?>
</tbody>
</table>
<?php } ?>
<?php
}
if (!empty($object['Attribute'])) {
?>
<table class="ObjectAttributes table table-condensed table-striped" style="text-align:left;margin-bottom:20px;">
<thead>
<th><?php echo __('Attribute');?></th>
@ -135,7 +138,6 @@
</thead>
<tbody>
<?php
if (!empty($object['Attribute'])) {
foreach ($object['Attribute'] as $a => $attribute) {
echo '<tr class="ObjectAttribute">';
echo '<td class="ObjectRelation">' . h($attribute['object_relation']) . '</td>';