mirror of https://github.com/MISP/MISP
fix: [object:deltaMerge] Stopped updating object's attributes when updating the FS/LS.
- Make sure to compare the correct date value of FS/LS and not their representationpull/6590/head
parent
17c793d10f
commit
774c4c104a
|
@ -793,7 +793,7 @@ class MispObject extends AppModel
|
|||
if ($f == 'sharing_group_id' && empty($newAttribute[$f])) {
|
||||
$newAttribute[$f] = 0;
|
||||
}
|
||||
if (isset($newAttribute[$f]) && $newAttribute[$f] != $originalAttribute[$f]) {
|
||||
if (isset($newAttribute[$f]) && $this->attributeValueDifferent($originalAttribute[$f], $newAttribute[$f], $f)) {
|
||||
$different = true;
|
||||
}
|
||||
}
|
||||
|
@ -1486,4 +1486,13 @@ class MispObject extends AppModel
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function attributeValueDifferent($newValue, $originalValue, $field)
|
||||
{
|
||||
if (in_array($field, ['first_seen', 'last_seen'])) {
|
||||
return new DateTime($newValue) != new DateTime($originalValue);
|
||||
} else {
|
||||
return $newValue != $originalValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue