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

HTML entities not decoded in emailed message subject

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4
    • Fix Version/s: 1.9.7
    • Component/s: Messages
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When a user send a message to another user an email is sent with the subject taken form the first line of the message. What if that line has special html characters? The bug first appeared with quotations being shown in the subject of the mail as follows:

      "Hi Susan i would like to"

      In order to solve this bug I propose to use html_entity_decode() php function. The code would be as follows:
      In /message/lib.php on line 975:

      $messagesubject = preg_replace('/\s+/', ' ', strip_tags($message)); // make sure it's all on one line

      $messagesubject = html_entity_decode($messagesubject);

      $messagesubject = message_shorten_message($messagesubject, 30).'...';

        Attachments

          Activity

            People

            Assignee:
            andyjdavis Andrew Davis
            Reporter:
            fbotti Federico Botti
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              25/Nov/09