Moodle
  1. Moodle
  2. MDL-32026

Messaging: preference absence error uses non-existing variable

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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
    • Rank:
      38698

      Description

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

        Issue Links

          Activity

          Hide
          Ruslan Kabalin added a comment -

          Can be cleanly cherry-picked to earlier version branches

          Show
          Ruslan Kabalin added a comment - Can be cleanly cherry-picked to earlier version branches
          Hide
          Dan Poltawski added a comment -

          Hi Ruslan,

          Looks fine but the english in the commit message isn't great (for one thing absense should be absence).

          I think it would be helpful to reword it

          thanks

          Show
          Dan Poltawski added a comment - Hi Ruslan, Looks fine but the english in the commit message isn't great (for one thing absense should be absence). I think it would be helpful to reword it thanks
          Hide
          Ruslan Kabalin added a comment -

          Commit message has been amended, thanks.

          Show
          Ruslan Kabalin added a comment - Commit message has been amended, thanks.
          Hide
          Dan Poltawski added a comment -

          Looks good - please add testing instrucitons and submit for integration

          Show
          Dan Poltawski added a comment - Looks good - please add testing instrucitons and submit for integration
          Hide
          Sam Hemelryk added a comment -

          Thanks Ruslan this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Ruslan this has been integrated now
          Hide
          Rajesh Taneja added a comment -

          Error message is visible.
          Thanks for fixing this Ruslan

          Show
          Rajesh Taneja added a comment - Error message is visible. Thanks for fixing this Ruslan
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And this has landed upstream, finally! Yay!

          תודה רבה && شكرا جزيلا



          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - And this has landed upstream, finally! Yay! תודה רבה && شكرا جزيلا Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: