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

Fixed Smilies and character escaping

Discussion in 'Resolved Bug Reports' started by Caelum, Nov 24, 2011.

  1. Caelum

    Caelum Well-Known Member

    Ran into an interesting bug just now. Smilies replacing strings of text involving : and \ characters don't work properly. Haven't tested it too thoroughly yet, but does look like an XF bug so far.

    To reproduce:
    • Create a new smiley.
    • Enable CSS sprite mode for good measure. I'd imagine it happens without it too, though
    • Make the smiley replace the following text: ':\' (without quotation marks)
    • When posting a thread, select the smiley manually through the smiley chooser. The bug doesn't happen when typing :\ out.
    • The smiley will not appear in the editor, but will appear in your post.
    The result in your post will be something along the lines of:
    Code:
    :\" class=
    Using XF 1.1.
     
  2. Robbo

    Robbo Well-Known Member

    I would assume the problem is just from back slashes being taken as an escape symbol instead of a character.
     
  3. Caelum

    Caelum Well-Known Member

    Yeah. Though, mind you, it only happens in combination with a colon. Scratch that, it happens with some other characters too, for instance '=\'.
     
  4. Robbo

    Robbo Well-Known Member

    Try using two back slashes. So :\\
     
    Caelum likes this.
  5. Caelum

    Caelum Well-Known Member

    Weird. That one does work fine.
     
  6. Robbo

    Robbo Well-Known Member

    It is a programming thing. \ will escape a character to use it differently. Say you want to write out a string "don't" and you are using ' to surround a string. You would get 'don't'... this would be a syntax error because of the second '. When programming to avoid this we escape it. So 'don\'t' would work fine. I am assuming XenForo uses regex to find smilies in the post and \ is also used to escape regex symbols. This can easily be fixed with a function however it might be working like this for a reason and just require a explanation in the ACP so people know.
     
    Caelum likes this.
  7. James

    James Well-Known Member

    I think it should be escaping by default.
     
  8. Mike

    Mike XenForo Developer Staff Member

    This looks like a TinyMCE bug, but I think I've managed to workaround it.
     
    Caelum likes this.
  9. Caelum

    Caelum Well-Known Member

    The good news is that as of XF 1.1.1 it works fine on initial posting. The bad news is, the moment you edit a post that has a :\-smiley in it, it breaks again and the bug comes back.
     
  10. Mike

    Mike XenForo Developer Staff Member

    Should be worked around again now by adding this to the XenForo_BbCode_Formatter_Wysiwyg class:
    Code:
    protected $_smilieTemplate = '<img src="%1$s" class="mceSmilie" alt="%2$s " />';
     
    Caelum likes this.

Share This Page