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

messagelib is using is_int() on userids, which causes message send to fail sometimes. Needs to be is_numeric().

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide
      1. Dump the attached test.php in root of your moodle install
      2. Edit test.php and change the $eventdata->userto to a valid user id
      3. Run test.php from browser
      4. make sure you get "Success" echoed
      5. login as the userto user and make sure you get the msg
      Show
      Dump the attached test.php in root of your moodle install Edit test.php and change the $eventdata->userto to a valid user id Run test.php from browser make sure you get "Success" echoed login as the userto user and make sure you get the msg
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-34535-master

      Description

      Writing a module that send a message like this fails because line 63 of messagelib.php doesn't recognise the userid which comes in as a string.

      $eventdata = new stdClass();
      $eventdata->component = 'mod_coursework';
      $eventdata->name = 'deadlinechanged';
      $eventdata->userfrom = $USER;
      // $dbrecord is from a standard $DB->get_record() call
      $eventdata->userto = $dbrecord->studentid;
      // etc
       
      message_send($eventdata);

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Sep/12