catalyst / moodle-mod_scormremote

A Moodle activity for serving SCORM packages remotely to another LMS across domains
https://moodle.org/plugins/mod_scormremote
Other
9 stars 3 forks source link

Coding problem: $PAGE->context was not set on starting SCORM #54

Open leonstr opened 11 months ago

leonstr commented 11 months ago

lib.php:scormremote_pluginfile() calls exit($OUTPUT->render_from_template(...)) to render output which results in a warning if debugging is enabled for the site: Debugging: Coding problem: $PAGE->context was not set....

Using Moodle 4.1.4+ (Build: 20230623) and mod_scormremote 2023070600 (44d5d9d).

Steps to reproduce issue

  1. Step up a SCORM hosted on Moodle, generate the wrapper and add the wrapper to a remote LMS.
  2. On the Moodle hosting the SCORM enable debugging.
  3. On the remote LMS enter the SCORM.

Expected results

No warning in PHP error log on the server hosting Moodle.

Actual results

Warning in PHP error log on the server hosting Moodle:

[31-Aug-2023 16:13:22 Europe/London] Debugging: Coding problem: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context(). The page may not display correctly as a result in 
* line 567 of /lib/pagelib.php: call to debugging()
* line 1696 of /lib/pagelib.php: call to moodle_page->magic_get_context()
* line 1972 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output()
* line 250 of /mod/scormremote/lib.php: call to bootstrap_renderer->__call()
* line 5212 of /lib/filelib.php: call to scormremote_pluginfile()
* line 44 of /pluginfile.php: call to file_pluginfile()