Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-3571

Filters: core_filters_get_available_in_context call can exceed PHP input variables limit

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.9.2
    • Fix Version/s: 3.9.3
    • Component/s: Filters
    • Labels:
    • Testing Instructions:
      Hide

      This issue only needs to be tested in 1 device.

      1. In web, in a master site as teacher/admin, create a course with more than 500 activities. The MM Dev Testing course currently has around 330.
      2. In the app, open the course. Check that you aren't required to reauthenticate and no error is displayed.
      Show
      This issue only needs to be tested in 1 device. In web, in a master site as teacher/admin, create a course with more than 500 activities. The MM Dev Testing course currently has around 330. In the app, open the course. Check that you aren't required to reauthenticate and no error is displayed.
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
    • Sprint:
      Moodle App 3.9.3

      Description

      The app calls core_filters_get_available_in_context to request information about all the activity contexts on a course. If there are a large number of activities on the course, this can hit the PHP input variable limit because there are a large number of parameters in the request (2 per context). Here is an example $_REQUEST object:

      Array
      (
      [moodlewsrestformat] => json
      [wsfunction] => core_filters_get_available_in_context
      [contexts] => Array
      (
      [0] => Array
      (
      [contextlevel] => module
      [instanceid] => 1605576
      )
      (....lots of entries omitted…)
      [499] => Array
      (
      [contextlevel] => module
      [instanceid] => 1606071
      )

      [500] => Array
      (
      [contextlevel] => module
      )
      )
      )

      In the above example, entry 500 only had half the data, there should have been other entries after 500, and the final 'wstoken' value has been chopped off, because the PHP max_input_vars setting on the server (set to default, 1000) has been exceeded.

      The request fails due to invalid token (since it wasn't supplied), which can cause the user to be prompted to log in again.

      The app should probably make this request in batches if there is a very large number (e.g. > 400).

        Attachments

          Activity

            People

            Assignee:
            dpalou Dani Palou
            Reporter:
            quen Sam Marshall
            Peer reviewer:
            Pau Ferrer
            Integrator:
            Juan Leyva
            Tester:
            Isabel Renedo Rouco
            Participants:
            Component watchers:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              30/Nov/20