Improve error handling of invalid category ids
authorMarcel Werk <burntime@woltlab.com>
Mon, 23 Sep 2024 08:55:58 +0000 (10:55 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 23 Sep 2024 08:55:58 +0000 (10:55 +0200)
wcfsetup/install/files/lib/page/ArticleRssFeedPage.class.php

index bf4d575869aaf0dac9299a3361d3d621577ec822..a6a38f21cdc2ea03e63c0262caddddffa9275872 100644 (file)
@@ -33,13 +33,14 @@ class ArticleRssFeedPage extends AbstractRssFeedPage
 
         if ($this->objectIDs !== []) {
             $this->categoryID = \reset($this->objectIDs);
-            $this->category = ArticleCategory::getCategory($this->categoryID);
-            if ($this->category === null) {
+            $category = ArticleCategory::getCategory($this->categoryID);
+            if ($category === null) {
                 throw new IllegalLinkException();
             }
-            if (!$this->category->isAccessible()) {
+            if (!$category->isAccessible()) {
                 throw new PermissionDeniedException();
             }
+            $this->category = $category;
         }
     }