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

          Issue Links

            Activity

            Hide
            kabalin Ruslan Kabalin added a comment -

            Can be cleanly cherry-picked to earlier version branches

            Show
            kabalin Ruslan Kabalin added a comment - Can be cleanly cherry-picked to earlier version branches
            Hide
            poltawski 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
            poltawski 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
            kabalin Ruslan Kabalin added a comment -

            Commit message has been amended, thanks.

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

            Looks good - please add testing instrucitons and submit for integration

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

            Thanks Ruslan this has been integrated now

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

            Error message is visible.
            Thanks for fixing this Ruslan

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

            And this has landed upstream, finally! Yay!

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



            Closing, ciao

            Show
            stronk7 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:
                  Fix Release Date:
                  14/May/12