Fixed Missing argument

kick

Well-known member
Affected version
2.1.8
On edit gallery comment, called setMessage();
PHP:
public function setMessage($message, $format = true)
    {
        if (!$this->comment->isChanged('message'))
        {
            $this->setupEditHistory();
        }
        return $this->commentPreparer->setMessage($message, $format, $this->performValidations);
    }
If we look at commentPreparer we will see the missing argument:
PHP:
public function setMessage($message, $format = true)
    {
        $preparer = $this->getMessagePreparer($format);
        $this->comment->message = $preparer->prepare($message);
        $this->comment->embed_metadata = $preparer->getEmbedMetadata();

        $this->quotedComments = $preparer->getQuotesKeyed('xfmg-comment');
        $this->mentionedUsers = $preparer->getMentionedUsers();

        return $preparer->pushEntityErrorIfInvalid($this->comment);
    }
When called, we do not have $this->performValidations.
Should be like that in Preparer:
PHP:
public function setMessage($message, $format = true, $checkValidity = true)
    {
        $preparer = $this->getMessagePreparer($format);
        $this->comment->message = $preparer->prepare($message, $checkValidity);
        $this->comment->embed_metadata = $preparer->getEmbedMetadata();

        $this->quotedComments = $preparer->getQuotesKeyed('xfmg-comment');
        $this->mentionedUsers = $preparer->getMentionedUsers();

        return $preparer->pushEntityErrorIfInvalid($this->comment);
    }
 
Back
Top Bottom