]> git.mxchange.org Git - friendica.git/commitdiff
Fixed:
authorRoland Häder <roland@mxchange.org>
Mon, 27 Jun 2022 09:37:34 +0000 (11:37 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 27 Jun 2022 09:39:18 +0000 (11:39 +0200)
- 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"

src/Model/Contact/User.php

index eb3d80eaa1ae77042987951700163deb5920b340..e0d6b1dcb2ed129900b797d8c390b6bd51579044 100644 (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'];
                        }
                }