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

Old messages are not displayed, incorrect empty string comparison operator

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.7
    • 2.8.8, 2.9.2
    • Messages
    • MySQL
    • MOODLE_28_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50880-master
    • Hide
      1. Send message between two users, make sure it is dipslayed
      2. Edit your database and set to null the field "smallmessage" in table "message", make sure the full message is displayed
      3. Repeat with "fullmessage"
      4. Similarly if fullmessageformat is set to 2 (FORMAT_HTML), for example badge issue notification, and "fullmessagehtml" is null, the "fullmessage" should be displayed
      Show
      Send message between two users, make sure it is dipslayed Edit your database and set to null the field "smallmessage" in table "message", make sure the full message is displayed Repeat with "fullmessage" Similarly if fullmessageformat is set to 2 (FORMAT_HTML), for example badge issue notification, and "fullmessagehtml" is null, the "fullmessage" should be displayed

    Description

      The text in old messages are not shown in a Moodle upgraded to 2.8+ version (upgraded in the next order: 1.9 -> 2.0 -->2.1 --> 2.2 --> 2.6-> 2.8). The new messages are shown normally and the date field on old messages are shown.

      The problem is the operator "!==" used to validate the empty values in function message_format_message_text. In some cases, the value is null and the condition is not satisfied.

      In order to correct the error, in file "message/lib.php", function message_format_message_text, change the conditions:

      if ($message->smallmessage !== '')
      by
      if (!empty($message->smallmessage))

      and:
      _if ($message->fullmessagehtml !== '') _
      by
      _if (!empty($message->fullmessagehtml)) _

      Attachments

        Activity

          People

            Unassigned Unassigned
            cirano David Herney Bernal
            Marina Glancy Marina Glancy
            David Monllaó David Monllaó
            David Monllaó David Monllaó
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              14/Sep/15