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

User fullname or course shortname with double quote breaks forum emails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0.3
    • 3.0, 3.1
    • Forum
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_30_STABLE
    • MDL-52136-master
    • Hide
      1. Purge caches
      2. Run unit tests
      3. Modify your user, course, and activity to have full names including characters:
        1. '
        2. "
          ## {{ foo }}
        3. \
          ## >
        4. <
      4. Send some forum posts and run cron
        ## Confirm that all messages appear with the correct values (don't forget to check HTML + Text version + Digests)
      5. Add the attached test.mustache to lib/templates and purge caches
      6. Open the template library and find the template
        1. Confirm that the template renders correctly
      7. Modify the template to remove the commented out call to str + purge caches
      8. Refresh the template page
      9. Find the template and open it
        1. Confirm that you get an error (the unquoted json breaks)
      10. Place the attached test.php into the root and run it with the CLI
        1. Confirm that the first string fails to render correctly, whilst the second renders correctly
      Show
      Purge caches Run unit tests Modify your user, course, and activity to have full names including characters: ' " ## {{ foo }} \ ## > < Send some forum posts and run cron ##  Confirm that all messages appear with the correct values (don't forget to check HTML + Text version + Digests) Add the attached test.mustache to lib/templates and purge caches Open the template library and find the template Confirm that the template renders correctly Modify the template to remove the commented out call to str + purge caches Refresh the template page Find the template and open it Confirm that you get an error (the unquoted json breaks) Place the attached test.php into the root and run it with the CLI Confirm that the first string fails to render correctly, whilst the second renders correctly

      While creating some tests for MDL-52126 I detected that sometimes there were some placeholders in the resulting email body not being replaced. Example of borked results with both user lastname and course shortname having a double quote:

      101'" -> Forums -> Moodle Forum'" -> Hello Moodle'" 
      http://www.example.com/moodle/mod/forum/discuss.php?d=285000
      Hello Moodle'"
      by {$a->name} - {$a->date}
      ---------------------------------------------------------------------
      Welcome to Moodle'"
       
      Attachment example.txt:
      http://www.example.com/moodle/pluginfile.php/237006/mod_forum/attachment/286000/example.txt
       
      ---------------------------------------------------------------------
      This not is not a copy of a message posted on the {$a->coursename} website.
       
      To reply click on this not link: {$a->replylink}
      

      • I tested backporting the test to 29_STABLE and it worked there.
      • I tested without the double quotes and then it worked.

      To reproduce:

      A) method A: Create a user fullname or a course shortname containing double quotes and create a forum post with them. Mail (text or html) will arrive with those placeholders not replaced (in the text part of the multipart).
      B) method B: Uncomment the TODO lines in mod/forum/tests/mail_test.php and the test will fail showing the results above.

        1. test.mustache
          1 kB
        2. test.php
          0.3 kB

            dobedobedoh Andrew Lyons
            stronk7 Eloy Lafuente (stronk7)
            cameron1729 cameron1729
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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