• Resolved Ov3rfly

    (@ov3rfly)


    If $chat_name contains a dot or other reserved characters for CSS, a script error appears in console when a live message is added:

    jquery.js?ver=1.12.4-wp:2 Uncaught Error: Syntax error, unrecognized expression: .sac-user-Tester-A.
        at Function.ea.error (jquery.js?ver=1.12.4-wp:2)
        at ea.tokenize (jquery.js?ver=1.12.4-wp:2)
        at ea.select (jquery.js?ver=1.12.4-wp:2)
        at Function.ea (jquery.js?ver=1.12.4-wp:2)
        at Function.a.find (jquery-migrate.min.js?ver=1.4.1:2)
        at n.fn.init.find (jquery.js?ver=1.12.4-wp:2)
        at n.fn.init.a.fn.find (jquery-migrate.min.js?ver=1.4.1:2)
        at a.fn.init.n.fn.init (jquery.js?ver=1.12.4-wp:2)
        at new a.fn.init (jquery-migrate.min.js?ver=1.4.1:2)
        at n (jquery.js?ver=1.12.4-wp:2)

    In this testcase the $user->display_name was Tester A. with a dot at the end of last name.

    Currently there is some sort of sanitization in simple_ajax_chat() which replaces spaces with dashes to convert the name to a CSS classname:

    $name_class = preg_replace("/[\s]+/", "-", $chat_name);
    

    That approach is obviously not sufficient to produce a valid classname, would recommend to use something like this instead:

    $name_class = sanitize_title( $chat_name );
    

    Thanks for great plugin.

Viewing 1 replies (of 1 total)
  • Plugin Author Jeff Starr

    (@specialk)

    This bug is resolved in the next version of SAC. Should be available before the WP 5.4 release. Thank you for reporting.

Viewing 1 replies (of 1 total)
  • The topic ‘Bug: Script error if $chat_name contains a dot’ is closed to new replies.