Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72708

Forum reply returns JSON error when a forum subject has a backslash \

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MDL-72708_forum-reply-returns-json-error-when-a-forum-subject-has-a-backslash
    • Hide
      1. Create a course.
      2. Go to the default forum.
      3. Click "Add discussion topic".
      4. Set the subject to "Test \ Backslash"
      5. Add any dummy message.
      6. Click "Post to Forum".
      7. Open the "Test \ Backslash" discussion.
      8. Click "Reply" to add an in-page reply
      9. Add any dummy message for the reply.
      10. Click "Post to Forum".
      11. Confirm there are No errors observed
      12. Before this fix, you get this error: "JSON.parse: bad escaped character at line 1 column 21 of the JSON data"
      Show
      Create a course. Go to the default forum. Click "Add discussion topic". Set the subject to "Test \ Backslash" Add any dummy message. Click "Post to Forum". Open the "Test \ Backslash" discussion. Click "Reply" to add an in-page reply Add any dummy message for the reply. Click "Post to Forum". Confirm there are No errors observed Before this fix, you get this error: "JSON.parse: bad escaped character at line 1 column 21 of the JSON data"

      Found in Moodle 3.10

      When you create a new discussion topic in a forum with a backslash \ in the subject and then reply to this, a JSON error appears: SyntaxError. Unexpected token at position 25.

      As a temporary solution we suggested to the users avoid using backslash in forum subjects, but if this can't be avoided it even affects when grading forums.

       

      Error:

      jQuery.Deferred exception: Unexpected token in JSON at position 25 SyntaxError: Unexpected token in JSON at position 25
      {{ at JSON.parse (<anonymous>)}}
      {{ at z.stringHelper (https://URL/lib/requirejs.php/1629225278/core/first.js:20:3752)}}
      {{ at z.<anonymous> (https://URL/lib/requirejs.php/1629225278/core/first.js:20:4655)}}
      {{ at n.renderSection (https://URL/lib/requirejs.php/1629225278/core/first.js:81:5438)}}
      {{ at n.renderTokens (https://URL/lib/requirejs.php/1629225278/core/first.js:81:4625)}}
      {{ at n.renderBlock (https://URL/lib/requirejs.php/1629225278/core/first.js:81:6207)}}
      {{ at n.renderTokens (https://URL/lib/requirejs.php/1629225278/core/first.js:81:4764)}}
      {{ at n.render (https://URL/lib/requirejs.php/1629225278/core/first.js:81:4471)}}
      {{ at Object.a.render (https://URL/lib/requirejs.php/1629225278/core/first.js:81:7090)}}
      {{ at z.<anonymous> (https://URL/lib/requirejs.php/1629225278/core/first.js:20:6059) undefined}}

        1. Screen Shot 2021-09-29 at 11.59.19.png
          60 kB
          Nydia Gabriela Fuentes
        2. Screen Shot 2021-09-29 at 11.59.52.png
          120 kB
          Nydia Gabriela Fuentes
        3. Screen Shot 2021-09-29 at 12.15.55.png
          148 kB
          Nydia Gabriela Fuentes

            Daniel Ziegenberg Daniel Ziegenberg
            gabrielafuentes Nydia Gabriela Fuentes
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.