mirror of
https://github.com/friendica/friendica
synced 2025-02-04 19:38:51 +00:00
Merge pull request #14639 from annando/warning
Fix warning "Trying to access array offset on value of type bool"
This commit is contained in:
commit
df85a9a63a
5 changed files with 947 additions and 935 deletions
|
@ -3357,6 +3357,16 @@ class Contact
|
|||
'writable' => 1,
|
||||
]);
|
||||
|
||||
if (!$contact_id) {
|
||||
DI::logger()->warning('Contact had not been added', ['url' => $url, 'uid' => $importer['uid']]);
|
||||
$contact_record = DBA::selectFirst('contact', ['id'], ['nurl' => Strings::normaliseLink($url), 'uid' => $importer['uid']]);
|
||||
if (empty($contact_record['id'])) {
|
||||
DI::logger()->error('Contact had not been found', ['url' => $url, 'uid' => $importer['uid']]);
|
||||
return null;
|
||||
}
|
||||
$contact_id = $contact_record['id'];
|
||||
}
|
||||
|
||||
// Ensure to always have the correct network type, independent from the connection request method
|
||||
self::updateFromProbe($contact_id);
|
||||
|
||||
|
|
|
@ -1866,6 +1866,11 @@ class GServer
|
|||
return $serverdata;
|
||||
}
|
||||
|
||||
if (!is_countable($data)) {
|
||||
DI::logger()->notice('Unexpected return type', ['url' => $url, 'data' => $data, 'serverdata' => $serverdata]);
|
||||
return $serverdata;
|
||||
}
|
||||
|
||||
if (count($data) == 1) {
|
||||
$serverdata['directory-type'] = self::DT_MASTODON;
|
||||
}
|
||||
|
|
|
@ -280,8 +280,8 @@ class Media
|
|||
// When the original picture is potentially animated but the preview isn't, we override the preview
|
||||
if (in_array($media['mimetype'] ?? '', ['image/gif', 'image/png']) && !in_array($imagedata['mime'], ['image/gif', 'image/png'])) {
|
||||
$media['preview'] = $media['url'];
|
||||
$media['preview-width'] = $media['width'];
|
||||
$media['preview-height'] = $media['height'];
|
||||
$media['preview-width'] = $media['width'] ?? $imagedata[0];
|
||||
$media['preview-height'] = $media['height'] ?? $imagedata[1];
|
||||
return $media;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ class Processor
|
|||
*/
|
||||
public static function updateItem(array $activity)
|
||||
{
|
||||
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity', 'post-type', 'private'], ['uri' => $activity['id']]);
|
||||
$item = Post::selectFirst(['uri', 'uri-id', 'guid', 'thr-parent', 'gravity', 'post-type', 'private'], ['uri' => $activity['id']]);
|
||||
if (!DBA::isResult($item)) {
|
||||
DI::logger()->notice('No existing item, item will be created', ['uri' => $activity['id']]);
|
||||
$item = self::createItem($activity, false);
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue