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

Checking permissions in a course throws a debugging error

    Details

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

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              mudrd8mz David Mudrák 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
              mudrd8mz David Mudrák 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
              mudrd8mz David Mudrák 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
              mudrd8mz David Mudrák 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
              mudrd8mz David Mudrák 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
              mudrd8mz David Mudrák 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
              rwijaya 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
              rwijaya 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
              rajeshtaneja 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
              rajeshtaneja 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
              stronk7 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
              stronk7 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
              stronk7 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
              stronk7 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
              samhemelryk Sam Hemelryk added a comment -

              Passed as bro!

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

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

              Closing, ciao

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

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

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

              should I reopen or clone this issue?

              Show
              skodak Petr Skoda added a comment - should I reopen or clone this issue?
              Hide
              skodak Petr Skoda 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
              skodak Petr Skoda 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
              dougiamas Martin Dougiamas added a comment -

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

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

              new issue created, thanks!

              Show
              skodak Petr Skoda added a comment - new issue created, thanks!

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    5/Dec/11