-
Bug
-
Resolution: Won't Fix
-
Major
-
None
-
3.1
This issue is now only about reverting MDL-53274
–
Original description:
Since MDL-53274, any Ajax/WS call that runs on a context that is not a course/module context may throw an exception, especially when dealing with renderers which is required for export_for_template. This is due to the PAGE->context not being set.
I suggest that we always set the PAGE->context in validate_context, regardless of the contextlevel. Possibly simply by using require_login.
If we don't, we will soon end-up with these, which are just the same thing but as a local hack:
https://github.com/moodle/moodle/blob/master/tag/classes/external.php#L194
(this one does not even call validate_context at all, but that is another problem)
Edit: Actually, it is part of the problem as validate_context should always be called, and if not then I agree that an exception should be raised. So, if we combine validate_context + automatically setting PAGE->context to whichever context was validated, we're good to go. However that may not be easy as we can not change PAGE->context once set, and that will definitely happen in bulk Ajax calls.
- blocks
-
MDL-53451 Integrate CBE as a core plugin
- Closed
- is a regression caused by
-
MDL-53274 Throw exception (in developer mode) if page context is not set, otherwise it is not noticeable in AJAX calls
- Closed
- will be (partly) resolved by
-
MDL-53772 Fix $PAGE->context issues with validate_context()
- Closed