Not a bug Media Gallery override maximum images on message

kick

Well-known member
Affected version
2.1.8
PHP:
public function checkValidity($message)
    {
        $isValid = parent::checkValidity($message);

        /** @var \XF\BbCode\ProcessorAction\AnalyzeUsage $usage */
        $usage = $this->bbCodeProcessor->getAnalyzer('usage');

        if ($this->isValid)
        {
            $maxImages = $this->constraints['maxImages'];
            if ($maxImages && $usage->getTagCount('img') + $usage->getTagCount('gallery') > $maxImages)
            {
                $this->errors[] = \XF::phraseDeferred(
                    'please_enter_message_with_no_more_than_x_images',
                    ['count' => $maxImages]
                );
                $this->isValid = false;
            }
        }

        return $this->isValid;
    }
This function increment maximum images on post.
if ($maxImages && $usage->getTagCount('img') + $usage->getTagCount('gallery') > $maxImages)
And dead variable $isValid.
1584602577259.png
1584602600907.png
1584602621293.png
 
Last edited:
The $isValid variable is unused though that doesn't actually matter and we wouldn't consider that to be a bug.

The parent method call sets the isValid property on the class and then that is used consistently throughout the remainder of the function and behaves correctly.

I believe your screenshots are trying to demonstrate somehow that the option no longer works, but you appear to have misunderstood how it does work.

The option is the maximum number of images per message. This does not restrict how many attachments can be uploaded to a message. By image we mean usages of the [IMG] tag BB code.

There are separate options which control the number of attachments you can have per message.
 
Top Bottom