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

$PAGE->context not set for shibboleth login page

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.2, 2.7
    • Fix Version/s: 2.5.6, 2.6.3
    • Component/s: Authentication
    • Labels:
    • Testing Instructions:
      Hide
      1. Enable shibboleth authentication.
      2. Turn on developer-level debugging.
      3. Add a custom profile field of type "Dropdown menu".
      4. Login with shibboleth.

      You shouldn't get any notices.

      If the tester doesn't have a shibboleth installation handy, it can be 'faked' in apache as follows:

      1. Enable shibboleth authentication in moodle.
      2. In moodle shibboleth config, set Username to "eppn".
      3. Place an .htaccess file in auth/shibboleth containing: SetEnv eppn "test@example.com"
      4. Logout of the site
      5. Visit the URL auth/shibboleth/index.php

      This should log you in as user test@example.com. Again, verify that no messages were generated.

      Show
      Enable shibboleth authentication. Turn on developer-level debugging. Add a custom profile field of type "Dropdown menu". Login with shibboleth. You shouldn't get any notices. If the tester doesn't have a shibboleth installation handy, it can be 'faked' in apache as follows: Enable shibboleth authentication in moodle. In moodle shibboleth config, set Username to "eppn". Place an .htaccess file in auth/shibboleth containing: SetEnv eppn "test@example.com" Logout of the site Visit the URL auth/shibboleth/index.php This should log you in as user test@example.com. Again, verify that no messages were generated.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-45118-shibboleth-login-warning

      Description

      If a custom user profile menu field is defined, then Shibboleth login will generate a developer error during login:

      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

      line 451 of /lib/pagelib.php: call to debugging()
      line 734 of /lib/pagelib.php: call to moodle_page->magic_get_context()
      line 1313 of /lib/weblib.php: call to moodle_page->__get()
      line 23 of /user/profile/field/menu/field.class.php: call to format_string()
      line 509 of /user/profile/lib.php: call to profile_field_menu->profile_field_menu()
      line 530 of /user/profile/lib.php: call to profile_user_record()
      line 4784 of /lib/moodlelib.php: call to profile_load_custom_fields()
      line 4337 of /lib/moodlelib.php: call to get_complete_user_data()
      line 48 of /auth/shibboleth/index.php: call to authenticate_user_login()

      This was partially fixed in MDL-27563 for auth/shibboleth/login.php. The issue in this ticket relates to auth/shibboleth/index.php.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            cibot CiBoT added a comment -
            Show
            cibot CiBoT added a comment - Results for MDL-45118 Remote repository: https://github.com/mpetrowi/moodle.git Remote branch MDL-45118 -shibboleth-login-warning to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3013 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3013/artifact/work/smurf.html
            Hide
            mpetrowi Matt Petro added a comment -

            This should be easy to cherrypick to stable branches.

            Show
            mpetrowi Matt Petro added a comment - This should be easy to cherrypick to stable branches.
            Hide
            skodak Petr Skoda added a comment -

            hi, thanks for the report and patch! sending to integration

            to integrators: please cherry pick to stables, thanks

            Show
            skodak Petr Skoda added a comment - hi, thanks for the report and patch! sending to integration to integrators: please cherry pick to stables, thanks
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Matt - this has been integrated now.

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Matt - this has been integrated now.
            Hide
            fred Frédéric Massart added a comment -

            Passed. I used the .htaccess trick.

            Show
            fred Frédéric Massart added a comment - Passed. I used the .htaccess trick.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Your code is now part of Moodle upstream, many thanks!

            It's a constant, continuous,
            spectacular world we live in,
            and every day you see things that
            just knock you out, if you pay attention.

            Robert Irwin

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Your code is now part of Moodle upstream, many thanks! It's a constant, continuous, spectacular world we live in, and every day you see things that just knock you out, if you pay attention. Robert Irwin

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14