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

user/messageselect.php $PAGE coding error [with patch]

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Messages
    • Labels:
      None
    • Environment:
      2.0 RC1 (Build: 20100925), Linux, Postgresql
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When selecting one or more users from the participants list in any given course and then choosing the "Send a message" action, the following debugging error message is displayed on the composing and preview screens that follow:

      Coding problem: this page does not set $PAGE->context properly.
      line 337 of /lib/pagelib.php: call to debugging()
      line 595 of /lib/pagelib.php: call to moodle_page->magic_get_context()
      line 1221 of /lib/weblib.php: call to moodle_page->__get()
      line 879 of /lib/pagelib.php: call to format_string()
      line 113 of /user/messageselect.php: call to moodle_page->set_title()
      line 48 of /user/action_redir.php: call to require_once()

      Based on what I saw in another similar bug report and fix, I applied the following patch:

      diff --git a/user/messageselect.php b/user/messageselect.php
      index 4c37e0b..32ea17d 100644
      — a/user/messageselect.php
      +++ b/user/messageselect.php
      @@ -57,6 +57,7 @@ if ($format !== FORMAT_MOODLE) {
      if ($deluser !== 0)

      { $url->param('deluser', $deluser); }

      +$PAGE->set_context(get_system_context());
      $PAGE->set_url($url);

      if (!$course = $DB->get_record('course', array('id'=>$id))) {

      This appears to have resolved the debugging issue.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            paul.ortman Paul Ortman
            Tester:
            Nobody
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Nov/10