• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Won't fix bbCodeStrip not stripping BBCodes in this case

Siropu

Well-known member
#1
When using this helper with BBCode like this:
PHP:
XenForo_Helper_String::bbCodeStrip('[BBCodeTag]blabla[/BBCodeTag]');
You get this:
When using this helper with BBCode like this:
PHP:
XenForo_Helper_String::bbCodeStrip('[BBCodeTag]blabla');
You get this:
[BBCodeTag]blabla
Which ends up like this once posted:
[BBCodeTag]blabla[/BBCodeTag]
So basically this helper is useless in this case.
 
Last edited:

Mike

XenForo developer
Staff member
#2
Realistically, this function won't change. It's mostly designed as a "quick and dirty" approach to stripping BB code and being wrong in edge cases is acceptable. For example, note that it really just strips things that look like BB code and doesn't respect the rules of the plain tag. Removing unmatched tags would lead to false positives far more often than what it currently misses.

A more accurate BB code removal system is available through XenForo_BbCode_Formatter_BbCode_Strip, though at the cost of it likely being slower.
 

Siropu

Well-known member
#3
Thank you for your answer. This wouldn't be a problem if the BBCode parser would not parse bbcodes without end tag, but it does. I will have to make a custom helper in this case.