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

$PAGE->context was not set errors related to availability_grade



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.1, 3.1.1
    • None
    • Conditional activities
    • None


      Hello, we just upgraded to 3.1 and are getting some "$PAGE->context was not set" errors. They don't happen all the time. Haven't been able to figure out the exact pattern, but they do appear to happen in bursts and are logged into the apache error logs, when running with Debug messages set to "All: Show all reasonable PHP debug messages". Appear to be coming from viewing a SCORM package.

      For example two variants:

      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 458 of /lib/pagelib.php: call to debugging()
      * * line 773 of /lib/pagelib.php: call to moodle_page->magic_get_context()
      * * line 1420 of /lib/weblib.php: call to moodle_page->get()
      * * line 1395 of /lib/grade/grade_item.php: call to format_string()
      * * line 192 of /availability/condition/grade/classes/condition.php: call to grade_item->get_name()
      * * line 145 of /availability/condition/grade/classes/condition.php: call to availability_grade\\condition::get_cached_grade_name()
      * * line 548 of /availability/classes/tree.php: call to availability_grade\\condition->get_description()
      * * line 476 of /availability/classes/tree.php: call to core_availability\\tree->get_full_information_recursive()
      * * line 216 of /availability/classes/info.php: call to core_availability\\tree->get_result_information()
      * * line 1801 of /lib/modinfolib.php: call to core_availability\\info->is_available()
      * * line 1830 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()
      * * line 1162 of /lib/modinfolib.php: call to cm_info->get_user_visible()
      * * line 2826 of /lib/moodlelib.php: call to cm_info->_get()
      * * line 939 of /mod/scorm/lib.php: call to require_login()
      * * line 4609 of /lib/filelib.php: call to scorm_pluginfile()
      * * line 37 of /pluginfile.php: call to file_pluginfile()
      * , referer: http://learning.siteurl.com/pluginfile.php/48262/mod_scorm/content/30/a001_12._references.html_

      And another version:
      PHP Notice: 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<ul style="text-align: left" data-rel="backtrace"><li>line 458 of /lib/pagelib.php: call to debugging()</li><li>line 773 of /lib/pagelib.php: call to moodle_page->magic_get_context()</li><li>line 1420 of /lib/weblib.php: call to moodle_page->_get()</li><li>line 1395 of /lib/grade/grade_item.php: call to format_string()</li><li>line 192 of /availability/condition/grade/classes/condition.php: call to grade_item->get_name()</li><li>line 145 of /availability/condition/grade/classes/condition.php: call to availability_grade
      condition::get_cached_grade_name()</li><li>line 548 of /availability/classes/tree.php: call to availability_grade
      condition->get_description()</li><li>line 476 of /availability/classes/tree.php: call to core_availability
      tree->get_full_information_recursive()</li><li>line 216 of /availability/classes/info.php: call to core_availabilit in /var/www/html/learning.siteurl.com/lib/weblib.php on line 3046, referer: http://learning.siteurl.com/mod/scorm/player.php


        Issue Links



              Unassigned Unassigned
              mgancarzdsi Mathew Gancarz
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona)
              2 Vote for this issue
              7 Start watching this issue