- 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"
This commit is contained in:
Roland Häder 2022-06-27 11:37:34 +02:00
parent 43531d5aa0
commit 7c049abfda
No known key found for this signature in database
GPG key ID: C82EDE5DDFA0BA77

View file

@ -183,7 +183,7 @@ class User
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'];
}
}
@ -192,7 +192,7 @@ class User
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'];
}
}