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

Messaging: preference absence error uses non-existing variable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.2, 2.3
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide

      In order to test this, you need to replicate an attempt to send message using non-existing component or provider name. For example, you may modify file message/lib.php the way:

      --- a/message/lib.php
      +++ b/message/lib.php
      @@ -2006,7 +2006,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
       
           $eventdata = new stdClass();
           $eventdata->component        = 'moodle';
      -    $eventdata->name             = 'instantmessage';
      +    $eventdata->name             = 'instantmessage_';
           $eventdata->userfrom         = $userfrom;
           $eventdata->userto           = $userto;

      Now try to send personal message to another user, upon the click "Send message", you will get coding exception that will contain the preference name causing error:

      Coding error detected, it must be fixed by a programmer: Could not load preference popup_provider_moodle_instantmessage__permitted. Does the component and name you supplied to message_send() match a row in message_providers? Message providers must appear in the database so users can configure how they will be notified when they receive messages.

      Show
      In order to test this, you need to replicate an attempt to send message using non-existing component or provider name. For example, you may modify file message/lib.php the way: --- a/message/lib.php +++ b/message/lib.php @@ -2006,7 +2006,7 @@ function message_post_message($userfrom, $userto, $message, $format) { $eventdata = new stdClass(); $eventdata->component = 'moodle'; - $eventdata->name = 'instantmessage'; + $eventdata->name = 'instantmessage_'; $eventdata->userfrom = $userfrom; $eventdata->userto = $userto; Now try to send personal message to another user, upon the click "Send message", you will get coding exception that will contain the preference name causing error: Coding error detected, it must be fixed by a programmer: Could not load preference popup_provider_moodle_instantmessage__permitted. Does the component and name you supplied to message_send() match a row in message_providers? Message providers must appear in the database so users can configure how they will be notified when they receive messages.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32026-master-2

      Description

      As per subject line. Use $defaultpreference instead which contains intuitive value.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/12