From bfa26c24d1c5251f0b961af4b8ed9a43a254476b Mon Sep 17 00:00:00 2001 From: celestora Date: Sun, 1 May 2022 17:04:59 +0300 Subject: [PATCH] Prevent deleted attachments from showing in wall.get --- VKAPI/Handlers/Wall.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index 6acc9c89..f678c4ff 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -23,11 +23,12 @@ final class Wall extends VKAPIRequestHandler foreach ($posts->getPostsFromUsersWall((int)$owner_id, 1, $count, $offset) as $post) { $from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId(); - $attachments; - foreach($post->getChildren() as $attachment) - { - if($attachment instanceof \openvk\Web\Models\Entities\Photo) - { + $attachments = []; + foreach($post->getChildren() as $attachment) { + if($attachment instanceof \openvk\Web\Models\Entities\Photo) { + if($attachment->isDeleted()) + continue; + $attachments[] = [ "type" => "photo", "photo" => [