Prevent guests from being a comment’s content author
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 10 Aug 2020 10:01:43 +0000 (12:01 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 10 Aug 2020 10:01:43 +0000 (12:01 +0200)
wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php

index d3b7de04b8697bf77b469c59eb0be53598ed0224..5a0b97a36d483bbc887c3defe5bab56358d838b7 100644 (file)
@@ -215,6 +215,6 @@ class ArticleCommentManager extends AbstractCommentManager implements IViewableL
         */
        public function isContentAuthor($commentOrResponse) {
                $article = ViewableArticleRuntimeCache::getInstance()->getObject($this->getObjectID($commentOrResponse));
-               return $article->userID == $commentOrResponse->userID;
+               return $commentOrResponse->userID && $article->userID == $commentOrResponse->userID;
        }
 }
index 2675092639b24cc54a44d90aacc8f7d9959495ab..ae9aaccc0d831442b424d8a8a108f0a77e918f24 100644 (file)
@@ -257,6 +257,6 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa
         */
        public function isContentAuthor($commentOrResponse) {
                $userID = $this->getObjectID($commentOrResponse);
-               return $userID == $commentOrResponse->userID;
+               return $commentOrResponse->userID && $userID == $commentOrResponse->userID;
        }
 }