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

Moodle device selection causes error if $USER global is null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide

      Temporarily edit your config.php to create a wwwrootmismatch error (you'll need two valid urls pointing for the same Moodle instance). If you don't get an error then the fix works.

      Show
      Temporarily edit your config.php to create a wwwrootmismatch error (you'll need two valid urls pointing for the same Moodle instance). If you don't get an error then the fix works.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
      wip-MDL-27899-master

      Description

      If Moodle displays a screen when the $USER global is null, this causes an error because this scenario is not checked for in the code. Only time this happens AFAIK is when a wwwrootmismatch error occurs, but presumably there are other errors.

      Debug info: Argument 1 passed to check_user_preferences_loaded() must be an instance of stdClass, null given, called in /fs1/www_root/ajf425/github/lib/moodlelib.php on line 1553 and defined
      Stack trace:

      line 359 of /lib/setuplib.php: coding_exception thrown
      line 1327 of /lib/moodlelib.php: call to default_error_handler()
      line 1553 of /lib/moodlelib.php: call to check_user_preferences_loaded()
      line 7764 of /lib/moodlelib.php: call to get_user_preferences()
      line 534 of /lib/pagelib.php: call to get_user_device_type()
      line 615 of /lib/pagelib.php: call to moodle_page->magic_get_devicetypeinuse()
      line 1335 of /lib/pagelib.php: call to moodle_page->__get()
      line 1257 of /lib/pagelib.php: call to moodle_page->resolve_theme()
      line 1244 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output()
      line 2495 of /lib/weblib.php: call to bootstrap_renderer->__call()
      line 2495 of /lib/weblib.php: call to bootstrap_renderer->redirect_message()
      line 676 of /lib/setuplib.php: call to redirect()
      line 656 of /lib/setup.php: call to initialise_fullme()
      line 29 of /config.php: call to require_once()
      line 31 of /index.php: call to require_once()

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    1/Jul/11