Fixed \XF\BbCode\Processor::replaceOptionInTagOpen() does not handle multiple options properly

Kirby

Well-known member
Affected version
2.1.0 Beta 4
PHP:
$newValue = $this->convertTagOptionToString($newValue);

return preg_replace_callback(
    '#=("|\'|).*\]$#s',
    function ($match) use ($newValue)
    {
        if (strpos($newValue, '"') !== false)
        {
            $newValue = "'$newValue'";
        }
        else if (strpos($newValue, "'") !== false)
        {
            $newValue = "\"$newValue\"";
        }
        else
        {
            $newValue = $match[1] . $newValue . $match[1];
        }
        return '=' . $newValue . ']';
    },
    $open
);

If $newValue consists of multiple options like type="full" alt="1234" for an attachment, this ends up with a broken option string like type='type="full" alt="1234"'
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.1.0 Beta 5).

Change log:
Improve handling of replacing contents of arrays of BB code options.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Back
Top Bottom