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

User profile field availability condition causes a coding error

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      0. Ensure availability is enabled.
      1. Create a new empty course. Do not enrol any users on the course.
      2. Add a new Assignment with default settings, except under Restrict access, add a Profile condition for address = x. Save and display.

      EXPECTED: The assignment displays with participants: 0.
      BEFORE FIX: Error occurs as described in this issue

      Show
      0. Ensure availability is enabled. 1. Create a new empty course. Do not enrol any users on the course. 2. Add a new Assignment with default settings, except under Restrict access, add a Profile condition for address = x. Save and display. EXPECTED: The assignment displays with participants: 0. BEFORE FIX: Error occurs as described in this issue
    • Workaround:
      Hide

      At least under simple conditions like this test, the problem will not occur if you have at least one student enrolled in the course.

      Show
      At least under simple conditions like this test, the problem will not occur if you have at least one student enrolled in the course.
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-47481-master

      Description

      Bug only exists in master.

      Reproduction steps

      1. Ensure 'enableavailability' is turned on for server.
      2. Go to a course and edit settings for any activity.
      3. Expand Restrict Access section
      4. Click the Add button to add a restriction, then click 'User profile' button on the popup.
      5. Select any profile field in the newly created item, and type a value
      6. Save changes.
      7. An error will display

      Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays
       
      More information about this error
       
      Debug info: 
      Error code: codingerror
      Stack trace:
      line 693 of /lib/dml/moodle_database.php: coding_exception thrown
      line 453 of /availability/condition/profile/classes/condition.php: call to moodle_database->get_in_or_equal()
      line 333 of /availability/classes/tree.php: call to availability_profile\condition->filter_user_list()
      line 612 of /availability/classes/info.php: call to core_availability\tree->filter_user_list()
      line 109 of /availability/classes/info_module.php: call to core_availability\info->filter_user_list()
      line 1385 of /mod/assign/locallib.php: call to core_availability\info_module->filter_user_list()
      line 1430 of /mod/assign/locallib.php: call to assign->list_participants()
      line 4126 of /mod/assign/locallib.php: call to assign->count_participants()
      line 549 of /mod/assign/locallib.php: call to assign->view_submission_page()
      line 53 of /mod/assign/view.php: call to assign->view()
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14