Resolution: Won't Fix
Affects Version/s: 3.1
Fix Version/s: None
Component/s: Web Services
Edit course/externallib.php and add the following at the start of search_courses . global $PAGE; $PAGE->context; Make sure the debugging level is set to developer Enable the Course meta link enrolment plugin Go to a course > Enrolment methods and ad a new instance of the Course meta link. Search for a course Confirm that you do not see any error
- Edit course/externallib.php and add the following at the start of search_courses.
- Make sure the debugging level is set to developer
- Enable the Course meta link enrolment plugin
- Go to a course > Enrolment methods and ad a new instance of the Course meta link.
- Search for a course
- Confirm that you do not see any error
Pull from Repository:
Pull Master Branch:
Pull Master Diff URL:
This issue is now only about reverting
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:
(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.