Fix undefined index addr notices in Model\Contact::getIdForURL

- Addresses https://github.com/friendica/friendica/issues/6918#issuecomment-502393030
This commit is contained in:
Hypolite Petovan 2019-06-15 17:16:10 -04:00
parent aa5a61baef
commit 14725bbd6a

View file

@ -1463,12 +1463,14 @@ class Contact extends BaseObject
return $contact_id;
}
$updated = ['addr' => $data['addr'],
$updated = [
'addr' => $data['addr'] ?? '',
'alias' => defaults($data, 'alias', ''),
'url' => $data['url'],
'nurl' => Strings::normaliseLink($data['url']),
'name' => $data['name'],
'nick' => $data['nick']];
'nick' => $data['nick']
];
if (!empty($data['keywords'])) {
$updated['keywords'] = $data['keywords'];
@ -1502,7 +1504,7 @@ class Contact extends BaseObject
$updated['pubkey'] = $data['pubkey'];
}
if (($data['addr'] != $contact['addr']) || (!empty($data['alias']) && ($data['alias'] != $contact['alias']))) {
if (($updated['addr'] != $contact['addr']) || (!empty($data['alias']) && ($data['alias'] != $contact['alias']))) {
$updated['uri-date'] = DateTimeFormat::utcNow();
}
if (($data["name"] != $contact["name"]) || ($data["nick"] != $contact["nick"])) {