slight improvements in handling empty objects

This commit is contained in:
nobody 2022-04-29 02:48:06 -07:00
parent 4aabd68c61
commit ad487eefe7
3 changed files with 6 additions and 5 deletions

View file

@ -2763,7 +2763,7 @@ class Activity
if (is_string($act->obj)) {
// Object was unfetchable.
return false;
// return false;
}
if (is_array($act->obj)) {
@ -3057,8 +3057,9 @@ class Activity
}
}
$s['obj_type'] = self::activity_obj_mapper($act->obj['type']);
if (is_array($act->obj)) {
$s['obj_type'] = self::activity_obj_mapper($act->obj['type']);
}
$s['obj'] = $act->obj;
if (is_array($s['obj']) && array_path_exists('actor/id', $s['obj'])) {
$s['obj']['actor'] = $s['obj']['actor']['id'];

View file

@ -2305,7 +2305,7 @@ class Libzot
}
}
if ($AS->obj['actor'] && $AS->obj['actor']['id'] && $AS->obj['actor']['id'] !== $AS->actor['id']) {
if (array_path_exists('actor/id', $AS->obj) && $AS->obj['actor']['id'] !== $AS->actor['id']) {
$y = import_author_xchan(['url' => $AS->obj['actor']['id']]);
if (!$y) {
logger('FOF Activity: no object actor');

View file

@ -4056,7 +4056,7 @@ function print_val($v, $escape = true)
function array_path_exists($str, $arr)
{
if (! ($arr && is_array($arr))) {
if (! (isset($arr) && is_array($arr))) {
return false;
}