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

codingerror in Global Search when "search within enrolled courses only" is set

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.5, 3.7.4, 3.8.1
    • Fix Version/s: None
    • Component/s: Global search
    • Labels:
    • Testing Instructions:
      Hide
      1. Navigate to Advanced Features in Site administration
      2. Tick Enable global search and press Save changes
      3. Navigate to Plugins > Search > Manage global search in Site administration
      4. Set the field Searchable courses to Search within enrolled courses only
      5. Navigate to Courses > Add a new course in Site administration
      6. Create the new course
      7. From the Actions menu click Permissions
      8. Enter "moodle/course:view" in the Filter field
      9. For the View courses without participation capability, in Roles with permission press the Allow button and click on Authenticated user
      10. Navigate to Users > Accounts > Add a new user in side administration
      11. Create the new user
      12. Log out
      13. Log in as the new user
      14. Click Site home from navigation
      15. Click on course created in step 4.
      16. In the Search box in the header enter "bar" and press return
      17. In the Search > Search within field select "Course: [Coursename]"
      18. Press Search
      19. Confirm you don't get a DML exception
      Show
      Navigate to Advanced Features in Site administration Tick Enable global search and press Save changes Navigate to Plugins > Search > Manage global search in Site administration Set the field Searchable courses to Search within enrolled courses only Navigate to Courses > Add a new course in Site administration Create the new course From the Actions menu click Permissions Enter "moodle/course:view" in the Filter field For the View courses without participation capability, in Roles with permission press the Allow button and click on Authenticated user Navigate to Users > Accounts > Add a new user in side administration Create the new user Log out Log in as the new user Click Site home from navigation Click on course created in step 4. In the Search box in the header enter "bar" and press return In the Search > Search within field select "Course: [Coursename] " Press Search Confirm you don't get a DML exception
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.7 Branch:
    • Pull 3.8 Branch:
    • Pull Master Branch:

      Description

      Steps to recreate -

      • enable global search on Moodle with all settings left as default
      • create a new course "veggies" and a label "cabbage"
      • give the course:view permission to "Authenticated users" for "veggies"
      • log in as a non-admin user, not registered on any courses
      • go into the "veggies" course and search for "cabbage" - no results, as expected, because "searchable courses" is still set to the default of "search within enrolled courses only"
      • from the "search within" drop-down menu choose "course: veggies" and search again

      Result -

      Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays

      Stack trace:

      • line 770 of /lib/dml/moodle_database.php: coding_exception thrown
      • line 593 of /search/classes/manager.php: call to moodle_database->get_in_or_equal()
      • line 778 of /search/classes/manager.php: call to core_search\manager->get_areas_user_accesses()
      • line 684 of /search/classes/manager.php: call to core_search\manager->search()
      • line 150 of /search/index.php: call to core_search\manager->paged_search()

      The error doesn't occur if you've changed "searchable courses" to "search within all courses the user can access"
       

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            mjr66 Mat Ridley
            Peer reviewer:
            Simey Lameze
            Integrator:
            Eloy Lafuente (stronk7)
            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:
            6 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 2 minutes
                3h 2m