Editing a post converts tags to use < and > brackets and not [ and ] by Franpa at 8:07 AM EDT on October 9, 2012
When editing a post that contains tags like [small] and [ /small] the forum software will convert the tags to use < and > brackets so it looks like <small> and </small>.
The forum software doesn't recognize the latter tag formatting so this doesn't make much sense.
Well, they're meant to be used in pairs. I'm not sure I understand what the issue is.
Oh, I get it, the less than/greater than character code (& lt; & gt;) is being converted to a literal < >, and then the tag translation is being applied.
edited 8:48 AM EDT October 9, 2012
Yeah, the edit converter ought to be doing those operations in the reverse order, good catch. I hope that fixing this doesn't open up a new can of worms.
<small>small</small>
edited 9:04 AM EDT October 9, 2012
htmlspecialcharacters_decode is still a bit overzealous (it converts &lt; all the way back to < in one pass, if you try to edit this < will become <), but I think this is doing closer to what is reasonable now.
edited 9:08 AM EDT October 9, 2012
edited 9:11 AM EDT October 9, 2012
Never mind the htmlspecialcharacters_decode comment, for whatever reason I'd forgotten that the text edit form needs <> escaped like anything else.
edited 9:14 AM EDT October 9, 2012
edited 9:16 AM EDT October 9, 2012
Yeah so I think I'll just pull out the htmlspecialcharacters_decode altogether, someone could do something tricky with a </textarea> blah
edited 9:17 AM EDT October 9, 2012 "quotes still ok?"
I'm not even aware if it is possible to do a quote on this forum lol. Aside from that yes, go ahead and do... what ever it is you are doing ;)
test
edited 4:58 PM EDT October 9, 2012
edited 4:58 PM EDT October 9, 2012
Appears to be working fine now! Great work! Yes I don't quite grasp the terms you are throwing around but I understand that you don't quite know exactly how to fix this issue and you have simply removed the conversion feature entirely for the time being?
Hm, I had typed up a long explanation but I realized that I'm still not 100% sure what issue you were encountering. The bug I found was that if you type <small>, it gets converted to [small], which sounds like the opposite of what you reported.
It was wrong anyway, and with some mismatched tags it may have looked like the other way 'round. The bottom line is that I shouldn't have been doing htmlspecialchars_decode anyway, it opened the door for a bit of XSS and broke a few things to boot.