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

Fixed i broke the post parser

Discussion in 'Resolved Bug Reports' started by Jake Bunce, Oct 12, 2011.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Paste this into a post and watch what happens:


    [quote="Dean_test, post: 270791, member: 11467"]Life is grand :)[/quote]

    Demo in next post...
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    For the purpose of experimentation... it works if you add an ending double quote to the URL tag, or if you make the QUOTE block unattributed.
  4. Dean_test

    Dean_test New Member

    Interesting. I got 2 Alerts that 2 of this test accounts posts have been quoted...

    (posted from Dean's test account, obviously)
  5. digitalpoint

    digitalpoint Well-Known Member

    I ran into the same issue trying to post something and for the first time in my life I kind of wanted to punch a baby. Was doing all sorts of whacky stuff (not just what you see in the example). lol

    Solution ended up being to make sure I put nothing after the closing /CODE (obviously not a viable long-term solution... heh)
  6. Shelley

    Shelley Well-Known Member

    Ah that explains what happened. I had some wacky stuff happening and wondering what the hell was going on.
  7. Mike

    Mike XenForo Developer Staff Member

    I'm not sure this is fixable.

    Our BB code parser automatically closes unclosed tags at the end of the post - this is a big element of what you're seeing. Obviously, the URL tag has been misformatted, but it actually finds a matching end with the quote tag. Because of that match, it has eaten the code close as part of the URL tag, so no code close tag is seen. Which means that it gets automatically closed at the end of the post.

    Of course, given this is a code tag, the URL tag within shouldn't be parsed as BB code. Maybe that's an area I can target, but I'm not sure yet.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    To put this into context... I originally discovered the problem with this code:


    $message['messageHtml'] = preg_replace('/\[url\]/', '', $post['message']);
    $message['messageHtml'] = preg_replace('/\[url=".+"\]/', '', $post['message']);
    $message['messageHtml'] = preg_replace('/\[\/url]/', '', $post['message']);



    So this wasn't deliberate breakage. Afterwards I tried to narrow down the problem and was able to reproduce it with just a URL tag.
  9. Mike

    Mike XenForo Developer Staff Member

    Actually, this was surprisingly easy to handle: if a "plain text" tag is opened, never let another tag try to be opened within it (as it can't be, it's always text).
    Jay likes this.

Share This Page