As designed Bad rendering of BBcode (highly nested tags not rendered)

I am currently working with a forum recently imported from SMF 2.0. Import worked correctly; however, many messages which were displayed correctly in the SMF version fail badly in XF, to the point of being unreadable. The BBcode was not corrupted during the import, as verified by a check of the database directly. It seems that there is a major fault in the BBcode renderer in XF, one which also replicates on xenforo.com (here). There are many more examples, which I can provide as I slog through them.
 
This is expected. Your message nests a crazy amount of colors:
Code:
[center][color=cyan][SIZE=17px]O[/SIZE][b]_[/b][SIZE=17px]O[/SIZE][/color][/center][color=cyan]

[left]Okay, well. Some corrections are clearly needed; [color=#999999]l[color=#999997]a[color=#9A9A96]s[color=#9A9B95]t[color=#9B9C93] [color=#9C9C92]t[color=#9C9D91]i[color=#9D9E8F]m[color=#9D9F8E]e[color=#9E9F8D] [color=#9FA08B]I[color=#9FA18A] [color=#A0A289]w[color=#A0A287]a[color=#A1A386]s[color=#A2A485] [color=#A2A583]v[color=#A3A682]e[color=#A3A681]r[color=#A4A77F]y[color=#A5A87E] [color=#A5A97D]t[color=#A6A97B]i[color=#A6AA7A]r[color=#A7AB79]e[color=#A8AC77]d[color=#A8AC76] [color=#A9AD75]a[color=#A9AE73]n[color=#AAAF72]d[color=#ABAF71] [color=#ABB070]c[color=#ACB16E]l[color=#ACB26D]e[color=#ADB36C]a[color=#AEB36A]r[color=#AEB469]l[color=#AFB568]y[color=#AFB666] [color=#B0B665]a[color=#B1B764]p[color=#B1B862]p[color=#B2B961]r[color=#B2B960]o[color=#B3BA5E]a[color=#B4BB5D]c[color=#B4BC5C]h[color=#B5BC5A]i[color=#B5BD59]n[color=#B6BE58]g[color=#B7BF56] [color=#B7C055]t[color=#B8C054]o[color=#B8C152]t[color=#B9C251]a[color=#BAC350]l[color=#BAC34E] [color=#BBC44D]i[color=#BBC54C]n[color=#BCC64B]c[color=#BDC649]o[color=#BDC748]h[color=#BEC847]e[color=#BEC945]r[color=#BFC944]e[color=#C0CA43]n[color=#C0CB41]c[color=#C1CC40]y[color=#C1CD3F];[color=#C2CD3D] [color=#C3CE3C]t[color=#C3CF3B]o[color=#C4D039]d[color=#C4D038]a[color=#C5D137]y[color=#C6D235] [color=#C6D334]I[color=#C7D333] [color=#C7D431]h[color=#C8D530]a[color=#C9D62F]v[color=#C9D62D]e[color=#CAD72C] [color=#CAD82B]h[color=#CBD929]a[color=#CCDA28]d[color=#CCDA27] [color=#CDDB26]f[color=#CDDC24]i[color=#CEDD23]v[color=#CFDD22]e[color=#CFDE20]?[color=#D0DF1F] [color=#D0E01E]l[color=#D1E01C]e[color=#D2E11B]t[color=#D2E21A]'[color=#D3E318]s[color=#D3E317] [color=#D4E416]s[color=#D5E514]a[color=#D5E613]y[color=#D6E712] [color=#D6E710]f[color=#D7E80F]i[color=#D8E90E]v[color=#D8EA0C]e[color=#D9EA0B] [color=#D9EB0A]c[color=#DAEC08]a[color=#DBED07]n[color=#DBED06]s[color=#DCEE04] [color=#DCEF03]o[color=#DDF002]f[color=#DEF101] Mountain Dew, so let's see how it goes![/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/left][color=#999999][color=#999997][color=#9A9A96][color=#9A9B95][color=#9B9C93][color=#9C9C92][color=#9C9D91][color=#9D9E8F][color=#9D9F8E][color=#9E9F8D][color=#9FA08B][color=#9FA18A][color=#A0A289][color=#A0A287][color=#A1A386][color=#A2A485][color=#A2A583][color=#A3A682][color=#A3A681][color=#A4A77F][color=#A5A87E][color=#A5A97D][color=#A6A97B][color=#A6AA7A][color=#A7AB79][color=#A8AC77][color=#A8AC76][color=#A9AD75][color=#A9AE73][color=#AAAF72][color=#ABAF71][color=#ABB070][color=#ACB16E][color=#ACB26D][color=#ADB36C][color=#AEB36A][color=#AEB469][color=#AFB568][color=#AFB666][color=#B0B665][color=#B1B764][color=#B1B862][color=#B2B961][color=#B2B960][color=#B3BA5E][color=#B4BB5D][color=#B4BC5C][color=#B5BC5A][color=#B5BD59][color=#B6BE58][color=#B7BF56][color=#B7C055][color=#B8C054][color=#B8C152][color=#B9C251][color=#BAC350][color=#BAC34E][color=#BBC44D][color=#BBC54C][color=#BCC64B][color=#BDC649][color=#BDC748][color=#BEC847][color=#BEC945][color=#BFC944][color=#C0CA43][color=#C0CB41][color=#C1CC40][color=#C1CD3F][color=#C2CD3D][color=#C3CE3C][color=#C3CF3B][color=#C4D039][color=#C4D038][color=#C5D137][color=#C6D235][color=#C6D334][color=#C7D333][color=#C7D431][color=#C8D530][color=#C9D62F][color=#C9D62D][color=#CAD72C][color=#CAD82B][color=#CBD929][color=#CCDA28][color=#CCDA27][color=#CDDB26][color=#CDDC24][color=#CEDD23][color=#CFDD22][color=#CFDE20][color=#D0DF1F][color=#D0E01E][color=#D1E01C][color=#D2E11B][color=#D2E21A][color=#D3E318][color=#D3E317][color=#D4E416][color=#D5E514][color=#D5E613][color=#D6E712][color=#D6E710][color=#D7E80F][color=#D8E90E][color=#D8EA0C][color=#D9EA0B][color=#D9EB0A][color=#DAEC08][color=#DBED07][color=#DBED06][color=#DCEE04][color=#DCEF03][color=#DDF002][color=#DEF101][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color]

For various reasons (such as preventing PHP crashes due to stack overflows), XF limits tag nesting (to 20 levels deep). A rough count of the above code came to over 115 levels of nesting (for no benefit really).

Changing this would require code modifications, though I generally wouldn't recommend it.
 
I'm generally skeptical of the theory that the illegible rendering of these messages isn't a problem, when I'm currently sitting on a forum full of them. If some resolution isn't made, likely I'll have to switch back to SMF, which deals with them just fine without any stack overflows at all.

It seems as if the sane means of handling this is to assume that a new [color] that starts without ending the previous one is implicitly ending the previous one, like browsers do with HTML <li>. That removes the infinite-recursion issue, at least.
 
I'm generally skeptical of the theory that the illegible rendering of these messages isn't a problem, when I'm currently sitting on a forum full of them. If some resolution isn't made, likely I'll have to switch back to SMF, which deals with them just fine without any stack overflows at all.
These nested Bb Codes are not normal. It shows an issue at the source. Now if you want to increase XenForo depth limit, edit this file "XenForo_BbCode_Formatter_Base" (library directory) and this code:
PHP:
protected $_tagDepthLimit = 20;

No matter which script you use (XenForo or SMF), this will have an impact on your page rendering.
 
As I noted, SMF renders this exact code fine without any visible impact at all. (Though what Mike posted above isn't actually the code that went into the render; the input code didn't have a hundred [/color] tags at the end, nor the entirely superfluous repetition of a bunch of open and close color tags. I can only surmise these come out of the render failure, which makes it even stupider.) I surmise that it's treating a new opening [color] tag as implicitly closing the previous one, since it doesn't mean anything to have a nested [color] anyway.

I rather doubt increasing the tag depth limit will help. I don't want to replace render failures with stack overflows.
 
Back
Top Bottom