From 0afdf92ca159aa11c248fac75538533357463c2d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 12 Dec 2017 20:44:05 -0500 Subject: [PATCH] Fix self-contact creation - Discard useless intval() - Add proper condition for `self` --- src/Model/Contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index d7f27ddd55..2e1bc01c74 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -96,11 +96,11 @@ class Contact extends BaseObject public static function createSelfFromUserId($uid) { // Only create the entry if it doesn't exist yet - if (dba::exists('contact', ['uid' => intval($uid), 'self'])) { + if (dba::exists('contact', ['uid' => $uid, 'self' => true])) { return true; } - $user = dba::select('user', ['uid', 'username', 'nickname'], ['uid' => intval($uid)], ['limit' => 1]); + $user = dba::select('user', ['uid', 'username', 'nickname'], ['uid' => $uid], ['limit' => 1]); if (!DBM::is_result($user)) { return false; }