- Contact/User::isBlocked() needs to return boolean, but sometimes (strangely)
a NULL can come from database, so let's cast it
This tries to fix:
TypeError: "Return value of Friendica\Model\Contact\User::isBlocked() must be of the type bool, null returned"
if (!empty($cdata['public'])) {
$public_contact = DBA::selectFirst('user-contact', ['blocked'], ['cid' => $cdata['public'], 'uid' => $uid]);
if (DBA::isResult($public_contact)) {
- $public_blocked = $public_contact['blocked'];
+ $public_blocked = (bool) $public_contact['blocked'];
}
}
if (!empty($cdata['user'])) {
$user_contact = DBA::selectFirst('contact', ['blocked'], ['id' => $cdata['user'], 'pending' => false]);
if (DBA::isResult($user_contact)) {
- $user_blocked = $user_contact['blocked'];
+ $user_blocked = (bool) $user_contact['blocked'];
}
}