Schema.org Data is broken it first post contains tab / \XF::escapeString() does not handle JSON properly

Affected version
2.1.2

Kirby

Well-known member
If the first post of a thread contains a tab, the resulting schema.org DiscussionForumPosting JSON data is broken as the tab is not converted to \t:

\XF:\Template\Templater::filterEscape() assigns the passed in type json to $escape, but \XF::escapeString() does not handle tabs:

PHP:
case 'json':
    $value = strtr($value, [
        '\\' => '\\\\',
        '"' => '\\"',
        "\r" => '\r',
        "\n" => '\n',
        '/' => '\\/',
        '<!' => '\u003C!'
    ]);
    return $value;
 
Top