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

The character { on first char of a course will break course_summary

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.1
    • Blocks
    • None
    • MOODLE_401_STABLE

      If a course have exactly the fist character { and is not followed by an other {, the block course_summary will not be able to render, showing the error:

       

      SyntaxError:

      Unexpected token M in JSON at position 1.

       

      The M is the following character on the course name

       

      The the following examples course names

      {My}

      first course -> This will brake the block

      {\{My}

      first course -> This will works fine

      My first course -> This will works fine

       

      To replicate:

      Login in the Moodle Sandbox Instance as admin

      Acess the course My first course

      Edit the course name to {My} first course 

      Go to Participants

      Enrol the admin user as a student

      Access the My Courses tab

       

      For now I edit the file course/externallib.php and added the following snippet at line 3854. Dirty, but I needed to get it working, and I am not comfortable with the Moodle's JS yet.

      foreach($filteredcourses as $key => $value){
          $filteredcourses[$key]->fullname = str_replace(['{{', '{', '}}', '}'], '', $value->fullname);
      }

            Unassigned Unassigned
            ahwelp Artur Welp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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