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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4.6, 2.5.2
    • Fix Version/s: 2.6.4, 2.7.1
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41746-master

      Description

      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()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              damyon Damyon Wiese
              Reporter:
              damyon Damyon Wiese
              Peer reviewer:
              Petr Skoda
              Integrator:
              Marina Glancy
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jul/14