Unparsed tags render smilie replacement text in unknown tag options

Xon

Well-known member
Affected version
2.2.7 Patch 1
For example;

[url unfurl="true" metadata="O_o123"]example.com[/url]

On edit is rendered as;

[url unfurl="true" metadata="o_O123"]example.com[/url]


If the simile has multiple mappings, this may result in unexpected (and undesirable) changes to tag's option data.

The issue is in renderUnparsedTag which uses renderString without stopSmilies/plain/treatAsStructuredText being set when rendering the tag.
PHP:
public function renderUnparsedTag(array $tag, array $options)
{
   return $this->renderString($tag['original'][0], $options)
      . $this->renderSubTree($tag['children'], $options)
      . $this->renderString($tag['original'][1], $options);
}

I think this would work as a fix in EditorHtml::renderUnparsedTag or Html::renderUnparsedTag;
PHP:
public function renderUnparsedTag(array $tag, array $options)
{
   return $this->renderString($tag['original'][0], array_merge($options, ['plain' => true]))
      . $this->renderSubTree($tag['children'], $options)
      . $this->renderString($tag['original'][1], $options);
}
 
Last edited:
Top