Moodle
  1. Moodle
  2. MDL-29104

Checking permissions in a course throws a debugging error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide

      1. log in as admin and enable developer debugging
      2. Select "Settings -> Users -> Permissions -> Check permissions"
      3. Select user and click "show this user permission'
      4. Debug message should not appear.

      Show
      1. log in as admin and enable developer debugging 2. Select "Settings -> Users -> Permissions -> Check permissions" 3. Select user and click "show this user permission' 4. Debug message should not appear.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:
      wip-mdl-29104
    • Rank:
      18628

      Description

      While checking user permission in course throw debugging error.
      Steps to reproduce:

      1. log in as admin and enable developer debugging
      2. Select "Settings -> Users -> Permissions -> Check permissions"
      3. Select user and click "show this user permission'
      4. Debug message should appear.

        Issue Links

          Activity

          Hide
          David Mudrak added a comment -

          I just came to report this, too:

          optional_param_array() expects array parameters only: reportuser

          line 595 of /lib/moodlelib.php: call to debugging()
          line 356 of /user/selector/lib.php: call to optional_param_array()
          line 145 of /user/selector/lib.php: call to user_selector_base->load_selected_users()
          line 158 of /user/selector/lib.php: call to user_selector_base->get_selected_users()
          line 116 of /admin/roles/check.php: call to user_selector_base->get_selected_user()

          Show
          David Mudrak added a comment - I just came to report this, too: optional_param_array() expects array parameters only: reportuser line 595 of /lib/moodlelib.php: call to debugging() line 356 of /user/selector/lib.php: call to optional_param_array() line 145 of /user/selector/lib.php: call to user_selector_base->load_selected_users() line 158 of /user/selector/lib.php: call to user_selector_base->get_selected_users() line 116 of /admin/roles/check.php: call to user_selector_base->get_selected_user()
          Hide
          David Mudrak added a comment -

          Increasing priority to Major. This is not only about throwing a debugging message. The Check permission tool stopped working because of this and there is no workaround.

          Show
          David Mudrak added a comment - Increasing priority to Major. This is not only about throwing a debugging message. The Check permission tool stopped working because of this and there is no workaround.
          Hide
          David Mudrak added a comment -

          Please note - I did not check but probably all places using the dynamic user selector are broken now because of the regression.

          Show
          David Mudrak added a comment - Please note - I did not check but probably all places using the dynamic user selector are broken now because of the regression.
          Hide
          Rossiani Wijaya added a comment -

          Hi Raj,

          Beside the trailing white spaces on line 15, the patch looks good.

          Just out of curiosity, what would be the case that $this->name is an array?

          Show
          Rossiani Wijaya added a comment - Hi Raj, Beside the trailing white spaces on line 15, the patch looks good. Just out of curiosity, what would be the case that $this->name is an array?
          Hide
          Rajesh Taneja added a comment -

          Thanks Rossie
          It is used at multiple places, one of them is "assign system roles" (admin/roles/assign.php)

          Show
          Rajesh Taneja added a comment - Thanks Rossie It is used at multiple places, one of them is "assign system roles" (admin/roles/assign.php)
          Hide
          Eloy Lafuente (stronk7) added a comment - - edited

          Uhm, so we have one more place where we need to check $_REQUEST (filelib.php is using it too).

          I'm going to integrate this but, IMO, we should move this to central function as was commented @ MDL-26796.

          (adding Petr to let him know)

          Show
          Eloy Lafuente (stronk7) added a comment - - edited Uhm, so we have one more place where we need to check $_REQUEST (filelib.php is using it too). I'm going to integrate this but, IMO, we should move this to central function as was commented @ MDL-26796 . (adding Petr to let him know)
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          As commented above, feel free to prospect a better solution for all these cases having dual array/simple value behavior.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks! As commented above, feel free to prospect a better solution for all these cases having dual array/simple value behavior. Ciao
          Hide
          Sam Hemelryk added a comment -

          Passed as bro!

          Show
          Sam Hemelryk added a comment - Passed as bro!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          git & cvs repositories have been populated with this solution. Many thanks for your collaboration, yay!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - git & cvs repositories have been populated with this solution. Many thanks for your collaboration, yay! Closing, ciao
          Hide
          Petr Škoda added a comment -

          I am reverting this, we need to use $this->multiselect instead.

          Show
          Petr Škoda added a comment - I am reverting this, we need to use $this->multiselect instead.
          Hide
          Petr Škoda added a comment -

          should I reopen or clone this issue?

          Show
          Petr Škoda added a comment - should I reopen or clone this issue?
          Hide
          Petr Škoda added a comment -
              protected function load_selected_users() {
                  // See if we got anything.
                  if ($this->multiselect) {
                      $userids = optional_param_array($this->name, array(), PARAM_INTEGER);
                  } else {
                      $userid = optional_param($this->name, 0, PARAM_INTEGER);
                      if (empty($userid)) {
                          return array();
                      }
                      $userids = array($userid);
                  }
          
          Show
          Petr Škoda added a comment - protected function load_selected_users() { // See if we got anything. if ($ this ->multiselect) { $userids = optional_param_array($ this ->name, array(), PARAM_INTEGER); } else { $userid = optional_param($ this ->name, 0, PARAM_INTEGER); if (empty($userid)) { return array(); } $userids = array($userid); }
          Hide
          Martin Dougiamas added a comment -

          Any problem with an integrated fix is a new issue. Make a new issue.

          Show
          Martin Dougiamas added a comment - Any problem with an integrated fix is a new issue. Make a new issue.
          Hide
          Petr Škoda added a comment -

          new issue created, thanks!

          Show
          Petr Škoda added a comment - new issue created, thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: