-
Bug
-
Resolution: Fixed
-
Minor
-
4.4.5
If you make a request using pluginfile.php or tokenpluginfile.php for a resource on a course where the current user is not allowed access to it (not enrolled or course hidden), this displays a notice e.g. 'This course is currently unavailable to students'.
This behaviour (which comes from require_login) is OK, but it also throws an error in the server log, because if you display a page rather than just throwing an exception, you need to call $PAGE->set_url:
[2024-11-08 15:04:16.982287 GMT] [php:notice] [pid 25684:tid 1200] [client 127.0.0.1:50403] Debugging: This page did not call $PAGE->set_url(...). Using http://localhost/core-moodle-github/pluginfile.php/26747/mod_resource/content/0/gvVL52GbFV.png in
- line 685 of \lib\pagelib.php: call to debugging()
- line 966 of \lib\pagelib.php: call to moodle_page->magic_get_url()
- line 4520 of \lib\navigationlib.php: call to moodle_page->__get()
- line 844 of \lib\pagelib.php: call to settings_navigation->initialise()
- line 966 of \lib\pagelib.php: call to moodle_page->magic_get_settingsnav()
- line 755 of \lib\classes\navigation\views\secondary.php: call to moodle_page->__get()
- line 238 of \lib\classes\navigation\views\secondary.php: call to core\navigation\views\secondary->load_admin_navigation()
- line 894 of \lib\pagelib.php: call to core\navigation\views\secondary->initialise()
- line 966 of \lib\pagelib.php: call to moodle_page->magic_get_secondarynav()
- line 67 of \theme\boost\layout\drawers.php: call to moodle_page->__get()
- line 972 of \lib\classes\output\core_renderer.php: call to include()
- line 888 of \lib\classes\output\core_renderer.php: call to core\output\core_renderer->render_page_layout()
- line ? of unknownfile: call to core\output\core_renderer->header()
- line 109 of \lib\classes\output\bootstrap_renderer.php: call to call_user_func_array()
- line 2052 of \lib\weblib.php: call to core\output\bootstrap_renderer->__call()
- line 2476 of \lib\moodlelib.php: call to notice()
- line 2755 of \lib\moodlelib.php: call to require_login()
- line 370 of \mod\resource\lib.php: call to require_course_login()
- line 5279 of \lib\filelib.php: call to resource_pluginfile()
- line 44 of \pluginfile.php: call to file_pluginfile()
While this does not cause any practical problems (and for some reason the error is not displayed to user even if debugging is enabled), it does clutter up the server log.
To resolve this problem, pluginfile.php should probably set the page URL.