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

external_api::validate_context() only works once (throws debugging)

XMLWordPrintable

    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MDL-41746-master
    • Hide
      1. Read the code
      2. Pull the second commit in the branch - it is a bogus commit (that would work if you could define('WS_SERVER', true) in a unit test).
      3. Run the unit test. Verify they throw debugging and fail
      4. Change "define('WS_SERVER', false);" to "define('WS_SERVER', true);" in lib/setup.php
      5. Re-run the unit test. Verify they pass.
      Show
      Read the code Pull the second commit in the branch - it is a bogus commit (that would work if you could define('WS_SERVER', true) in a unit test). Run the unit test. Verify they throw debugging and fail Change "define('WS_SERVER', false);" to "define('WS_SERVER', true);" in lib/setup.php Re-run the unit test. Verify they pass.

      There are several webservices that are accepting a list of modules/course whatever and then operating on each thing in the list.

      Examples are mod_assign::get_grades, mod_forum::get_forums_by_courses, course::get_courses

      Because external_api::validate_context calls require_login on the context, it will only work for the first context in the list. Calling it with more than one context gives:

      Debugging: Coding problem: unsupported modification of PAGE->context from 70 to 70

      • line 928 of /lib/pagelib.php: call to debugging()
      • line 972 of /lib/pagelib.php: call to moodle_page->set_context()
      • line 2840 of /lib/moodlelib.php: call to moodle_page->set_cm()
      • line 356 of /lib/externallib.php: call to require_login()

            damyon Damyon Wiese
            damyon Damyon Wiese
            Petr Skoda Petr Skoda
            Marina Glancy Marina Glancy
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.