Fixed Incorrect context check in Trending and Featured Content widgets

DragonByte Tech

Well-known member
Affected version
2.3.0
Problem: The thread context isn't being correctly checked to ensure it is of instance XF\Entity\Thread.

Fixes:
Diff:
Index: src/XF/Widget/FeaturedContent.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/XF/Widget/FeaturedContent.php b/src/XF/Widget/FeaturedContent.php
--- a/src/XF/Widget/FeaturedContent.php
+++ b/src/XF/Widget/FeaturedContent.php
@@ -130,7 +130,7 @@
         }
 
         $thread = $this->contextParams['thread'] ?? null;
-        if ($thread && $forum instanceof Thread)
+        if ($thread && $thread instanceof Thread)
         {
             return [
                 'content_type' => 'thread',

Diff:
Index: src/XF/Widget/TrendingContent.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/XF/Widget/TrendingContent.php b/src/XF/Widget/TrendingContent.php
--- a/src/XF/Widget/TrendingContent.php
+++ b/src/XF/Widget/TrendingContent.php
@@ -108,7 +108,7 @@
         }
 
         $thread = $this->contextParams['thread'] ?? null;
-        if ($thread && $forum instanceof Thread)
+        if ($thread && $thread instanceof Thread)
         {
             return [
                 'content_type' => 'thread',
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.1).

Change log:
Fix thread context support for featured and trending widgets
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom