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

Old messages are not displayed, incorrect empty string comparison operator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.7
    • Fix Version/s: 2.8.8, 2.9.2
    • Component/s: Messages
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-50880-master

      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

        1. sintexto.png
          108 kB
          David Herney Bernal

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/15