Ensure strings are provided to BBCode::toPlaintext in include/api

- Prevents some type mismatch fatal errors with BBCode::performWithEscapedTags
This commit is contained in:
Hypolite Petovan 2020-06-04 23:39:53 -04:00
parent a132a21da7
commit 6774ee6691

View file

@ -624,7 +624,7 @@ function api_get_user(App $a, $contact_id = null)
'name' => $contact["name"], 'name' => $contact["name"],
'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']), 'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']),
'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol']), 'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol']),
'description' => BBCode::toPlaintext($contact["about"]), 'description' => BBCode::toPlaintext($contact["about"] ?? ''),
'profile_image_url' => $contact["micro"], 'profile_image_url' => $contact["micro"],
'profile_image_url_https' => $contact["micro"], 'profile_image_url_https' => $contact["micro"],
'profile_image_url_profile_size' => $contact["thumb"], 'profile_image_url_profile_size' => $contact["thumb"],
@ -698,7 +698,7 @@ function api_get_user(App $a, $contact_id = null)
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']), 'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']), 'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
'location' => $location, 'location' => $location,
'description' => BBCode::toPlaintext($description), 'description' => BBCode::toPlaintext($description ?? ''),
'profile_image_url' => $uinfo[0]['micro'], 'profile_image_url' => $uinfo[0]['micro'],
'profile_image_url_https' => $uinfo[0]['micro'], 'profile_image_url_https' => $uinfo[0]['micro'],
'profile_image_url_profile_size' => $uinfo[0]["thumb"], 'profile_image_url_profile_size' => $uinfo[0]["thumb"],