mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
fix bug with friends method when you can add non-existing or deleted users and yourself
This commit is contained in:
parent
1e5e9d7080
commit
991e377e16
1 changed files with 118 additions and 112 deletions
|
@ -73,6 +73,12 @@ final class Friends extends VKAPIRequestHandler
|
|||
|
||||
$user = $users->get(intval($user_id));
|
||||
|
||||
if(is_null($user)){
|
||||
$this->fail(177, "Cannot add this user to friends as user not found");
|
||||
} else if($user->getId() == $this->getUser()->getId()) {
|
||||
$this->fail(174, "Cannot add user himself as friend");
|
||||
}
|
||||
|
||||
switch ($user->getSubscriptionStatus($this->getUser())) {
|
||||
case 0:
|
||||
$user->toggleSubscription($this->getUser());
|
||||
|
|
Loading…
Reference in a new issue