Skip to content

Commit c0d8d2e

Browse files
committed
Filter out unknown response IDs
1 parent 90a4d17 commit c0d8d2e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponseProvider.class.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public function prepare(array $likes)
9696

9797
foreach ($likeData as $objectTypeID => $likes) {
9898
$objectType = CommentHandler::getInstance()->getObjectType($objectTypeID);
99-
if (CommentHandler::getInstance()->getCommentManager($objectType->objectType) instanceof IViewableLikeProvider) {
100-
/** @noinspection PhpUndefinedMethodInspection */
101-
CommentHandler::getInstance()->getCommentManager($objectType->objectType)->prepare($likes);
99+
$commentManager = CommentHandler::getInstance()->getCommentManager($objectType->objectType);
100+
if ($commentManager instanceof IViewableLikeProvider) {
101+
$commentManager->prepare($likes);
102102
}
103103
}
104104
}
@@ -114,7 +114,9 @@ public function getObjectsByIDs(array $objectIDs)
114114
{
115115
return \array_map(
116116
static fn(CommentResponse $comment) => new LikeableCommentResponse($comment),
117-
CommentResponseRuntimeCache::getInstance()->getObjects($objectIDs)
117+
\array_filter(
118+
CommentResponseRuntimeCache::getInstance()->getObjects($objectIDs),
119+
)
118120
);
119121
}
120122
}

0 commit comments

Comments
 (0)